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

Refactor then to async functions #80

Merged
merged 1 commit into from
Aug 20, 2015
Merged

Conversation

fson
Copy link
Member

@fson fson commented Aug 20, 2015

Replace all uses of Promise#then with async functions.

@freiksenet
Copy link
Contributor

Can't comment on lines from phone, but why do you need to await on close connection? Why not just return it?

Fine otherwise.

@fson
Copy link
Member Author

fson commented Aug 20, 2015

closeConnection is called on the tail event which is emitted after the response has been sent.

It seemed more prudent to await in case there's an error, but I guess that does not matter because the promise returned by this function is discarded anyway. 😄 An error would probably still bubble up to Bluebird's global handler that logs it in the console...

So I think it does not make any difference.

Replace all uses of `Promise#then` with async functions.
@fson fson force-pushed the refactoring/async-functions branch from 3144fbc to 6129437 Compare August 20, 2015 15:14
@fson
Copy link
Member Author

fson commented Aug 20, 2015

I've removed the await on conn.close(). This matches the previous behaviour with promises. Also maybe it makes it clearer that we discard the result.

@freiksenet
Copy link
Contributor

There is no difference between explicit await at the end of function and returning a promise. But it is confusing IMO, can be misinterpreted, please remove it.

@freiksenet
Copy link
Contributor

Thanks. Shipit.

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