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

Return statements after sendBadge() #316

Closed
jack126guy opened this issue Dec 8, 2014 · 1 comment
Closed

Return statements after sendBadge() #316

jack126guy opened this issue Dec 8, 2014 · 1 comment

Comments

@jack126guy
Copy link
Contributor

In server.js, I've noticed that there are return statements after some calls to sendBadge() but not after others. In my patch for Github license support, I've found that leaving out return leads to problems, so I've added them after all of the calls in my code.

TL;DR: Is return necessary after every call to sendBadge()?

@espadrine
Copy link
Member

What must not happen are two calls to sendBadge() for a single request, so as to avoid sending the response twice (which actually simply raises an exception, which we don't want).

What we also want to avoid are doing work (sending requests, etc.) which needn't be done. In most cases, if there isn't a return after sendBadge(), the rest of the function will get executed, which is pointless because the badge was already delivered.

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

No branches or pull requests

2 participants