Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove fetchMethodNames method in /imports/modules/rate-limit.js #24

Closed
aferreol opened this issue Jul 25, 2017 · 2 comments
Closed

Remove fetchMethodNames method in /imports/modules/rate-limit.js #24

aferreol opened this issue Jul 25, 2017 · 2 comments
Assignees
Labels

Comments

@aferreol
Copy link

You can directly access the methods name by using the property methods :

name(name) { return _.contains(methods, name); },

@cleverbeagle
Copy link
Owner

Can you provide more detail here? I don't see where the methods property is coming in from your example...

@aferreol
Copy link
Author

aferreol commented Jul 27, 2017

Directly from the assignLimits constant.

const assignLimits = ({ methods, limit, timeRange }) => {
  if (Meteor.isServer) {
    DDPRateLimiter.addRule({
      name(name) { return _.contains(methods, name); },
      connectionId() { return true; },
    }, limit, timeRange);
  }
};

This is not working : (no need to fetch the method names, it's already there)

const methodNames = fetchMethodNames(methods);

Already there because you call rateLimit like this :

rateLimit({
  methods: [
    'documents.insert',
    'documents.update',
    'documents.remove',
  ],
  limit: 5,
  timeRange: 1000,
});

@cleverbeagle cleverbeagle self-assigned this Jul 27, 2017
@cleverbeagle cleverbeagle changed the title DDPRateLimiter not working in this project, due to unecessary pluck Remove fetchMethodNames method in /imports/modules/rate-limit.js Jul 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants