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

Promise support for act/add/wrap #548

Closed
wyvernzora opened this issue Sep 18, 2016 · 6 comments
Closed

Promise support for act/add/wrap #548

wyvernzora opened this issue Sep 18, 2016 · 6 comments

Comments

@wyvernzora
Copy link

My company has been using Seneca in production for over a year now, and we have relied on a custom plugin to add promise support to Seneca. Here is the github repo for the plugin:

seneca-as-promised

Since I see that you have plans to include promise support into the Seneca itself, I thought it would be a good idea to share my existing work in that direction. This plugin has been in production for a few months now, and we have not encountered any issues with it so far.

Speaking of which, I would also really appreciate any feedback in case this plugin is doing anything it shouldn't.

@kristianmandrup
Copy link

Please mention this plugin as an option. This is 2017. To hell with callbacks!

@StarpTech
Copy link
Contributor

StarpTech commented Mar 5, 2017

Callbacks has still a performance benefit over Promises or Generators. Particularly in the transport layer performance is very important. There is no need to create a project for this. You can create a small abstraction to promisify all callbacks to promises but be careful that your this has the correct context. I wouldn't provide this as an option in the core because it operates out of the core.

http://senecajs.org/docs/tutorials/seneca-with-promises.html

@kristianmandrup
Copy link

Sure, avoid stateful services and messing with this!
Thanks for the tutorial link.

Bluebird promises benchmark

Funny how Bluebird performs way (x4 or more) better than native promises!

why-are-native-es6-promises-slower-and-more-memory-intensive-than-bluebird

@StarpTech
Copy link
Contributor

StarpTech commented Mar 5, 2017

@kristianmandrup when I mean this I talk about to get the right context if you have nested calls. This is very important for logging and tracing. E.g when you always use the core seneca instance in all acts and nested acts you will loose the information that your act failed in the specific call chain. This has nothing to do with stateful services.

@kristianmandrup
Copy link

Okay, thanks for clearing that up! I recall looking at Seneca two years ago but didn't seem quite ready. Nice to see the progress since then! Ready to use it now, callbacks or not :)
At least with micro services there should be limited callback hell!

@rjrodger
Copy link
Collaborator

@kristianmandrup correct - you don't really run into too many callback problems with small services.

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

4 participants