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

Fix duplicate events in dynamic services. #115

Merged
merged 5 commits into from
Feb 24, 2015
Merged

Conversation

marshallswain
Copy link
Member

After fixing setup() for dynamic services in the last PR (#110), the events mixin's setup() function was adding duplicate events. This PR wraps applyEvents with an if (!this._serviceEvents) { ... } check to assure it isn't adding events twice.

@marshallswain marshallswain force-pushed the fix-duplicate-events branch 2 times, most recently from 0ff943c to cbdd7d1 Compare February 17, 2015 16:32
@daffl
Copy link
Member

daffl commented Feb 17, 2015

Are you sure this is the best solution? I would think we just don't need to call applyEvents anymore since it will be mixed in and called with .setup, no?

@marshallswain
Copy link
Member Author

Alternatively we can remove applyEvents and move this line: https://github.com/feathersjs/feathers/blob/master/lib/application.js#L54
just before this.addService() (a few lines up).

You think that's a better solution?

@daffl
Copy link
Member

daffl commented Feb 17, 2015

You could just update this PR by pushing to the fix-duplicate-events branch again instead of opening a new one. Or was there a reason?

@marshallswain
Copy link
Member Author

Just so you could see the diff. Not trying to insult your intelligence. :)

@marshallswain
Copy link
Member Author

I was thinking of leaving it the other way in preparation for allowing providers to be registered at any time and making a single pathway for registering services instead of the duality going on right now with setup() and addService(). It's not that big of a change though, so it doesn't really matter.

@daffl
Copy link
Member

daffl commented Feb 18, 2015

I will have another look. I feel that there there is a good single way of doing this. Maybe you are right and mixins are not the way to go here.

@daffl
Copy link
Member

daffl commented Feb 23, 2015

I did some refactoring in https://github.com/feathersjs/feathers/blob/ffb603a4d8be2b309f26ad2e449611f8f94f9993/lib/providers/socket/commons.js that should handle both kinds of services properly and also made the socket handlers a little shorter and moved the dynamic service tests into nested describes. Can you double check if that solves all the issues and also makes sense?

@daffl daffl added this to the 1.1.0 milestone Feb 23, 2015
@marshallswain
Copy link
Member Author

Ahh... Yes. That is so much cleaner and solves the issue.

@daffl daffl force-pushed the fix-duplicate-events branch from ffb603a to b368eef Compare February 23, 2015 23:14
@daffl daffl removed this from the 1.1.0 milestone Feb 23, 2015
daffl added a commit that referenced this pull request Feb 24, 2015
Fix duplicate events in dynamic services.
@daffl daffl merged commit 81b938f into master Feb 24, 2015
@daffl daffl deleted the fix-duplicate-events branch February 24, 2015 00:14
daffl added a commit that referenced this pull request Aug 21, 2018
daffl added a commit that referenced this pull request Aug 22, 2018
daffl pushed a commit that referenced this pull request Aug 29, 2018
client should return a 401 error code when no token is provided
daffl pushed a commit that referenced this pull request Aug 29, 2018
client should return a 401 error code when no token is provided
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants