{"action":"created","issue":{"url":"https://api.github.com/repos/petkaantonov/bluebird/issues/532","labels_url":"https://api.github.com/repos/petkaantonov/bluebird/issues/532/labels{/name}","comments_url":"https://api.github.com/repos/petkaantonov/bluebird/issues/532/comments","events_url":"https://api.github.com/repos/petkaantonov/bluebird/issues/532/events","html_url":"https://github.com/petkaantonov/bluebird/issues/532","id":62825055,"number":532,"title":"A legitimate use for progress? ","user":{"login":"shaunc","id":193170,"avatar_url":"https://avatars.githubusercontent.com/u/193170?v=3","gravatar_id":"","url":"https://api.github.com/users/shaunc","html_url":"https://github.com/shaunc","followers_url":"https://api.github.com/users/shaunc/followers","following_url":"https://api.github.com/users/shaunc/following{/other_user}","gists_url":"https://api.github.com/users/shaunc/gists{/gist_id}","starred_url":"https://api.github.com/users/shaunc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shaunc/subscriptions","organizations_url":"https://api.github.com/users/shaunc/orgs","repos_url":"https://api.github.com/users/shaunc/repos","events_url":"https://api.github.com/users/shaunc/events{/privacy}","received_events_url":"https://api.github.com/users/shaunc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":23,"created_at":"2015-03-18T23:11:28Z","updated_at":"2015-03-21T20:15:06Z","closed_at":null,"body":"I realize that the progres api is deprecated. I have a use for it, which I can't think of another way to implement -- easily -- alternate suggestions are very welcome!\r\n\r\nI am modifying an ORM to support transactions. I want to be able to \"close\" a promise chain in a particular transaction without having to have to thread a transaction object through all the calls. Instead of passing the transaction in, my alternate solution is to pass an object out which will defer execution until given a transaction.\r\n\r\nAs the API and all the code is already passing bluebird promises out, a seemingly simple solution presents itself: at the bottom of the chain, when a query is ready for a transaction, it passes back a promise in which it calls \"progress\" with a callback. The transaction wrapper registers a progressed() handler which receives the callback, and calls it with the transaction, which then allows the query to proceed. (The transaction wrapper can check to make sure that it doesn't react to other progress() calls.)\r\n\r\nIn another thread about promises, I read one of the maintainers claim (in other words) that \"instead of progress you should use events\". However, here I need to know which promise chain I am in (as there could be other transactions also in progress). I don't see how I can do that with events.\r\n\r\nA dummy version passes some simple tests... I'm ready for to start more extensive work. Is there anything wrong with my approach? Is there an alternate solution? Is there, for instance, some way to identify which promise chain I'm in up to some \"checkpoint\" (ie the transaction wrapper)?\r\n\r\nIf this is a legitimate use for the progress interface, I would be very pleased if it were un-deprecated, with appropriate warnings put in for other uses for which it may be less suited."},"comment":{"url":"https://api.github.com/repos/petkaantonov/bluebird/issues/comments/84448679","html_url":"https://github.com/petkaantonov/bluebird/issues/532#issuecomment-84448679","issue_url":"https://api.github.com/repos/petkaantonov/bluebird/issues/532","id":84448679,"user":{"login":"shaunc","id":193170,"avatar_url":"https://avatars.githubusercontent.com/u/193170?v=3","gravatar_id":"","url":"https://api.github.com/users/shaunc","html_url":"https://github.com/shaunc","followers_url":"https://api.github.com/users/shaunc/followers","following_url":"https://api.github.com/users/shaunc/following{/other_user}","gists_url":"https://api.github.com/users/shaunc/gists{/gist_id}","starred_url":"https://api.github.com/users/shaunc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shaunc/subscriptions","organizations_url":"https://api.github.com/users/shaunc/orgs","repos_url":"https://api.github.com/users/shaunc/repos","events_url":"https://api.github.com/users/shaunc/events{/privacy}","received_events_url":"https://api.github.com/users/shaunc/received_events","type":"User","site_admin":false},"created_at":"2015-03-21T20:15:06Z","updated_at":"2015-03-21T20:15:06Z","body":"@benjamingr -- I am trying to write a document up. Do you have any links to discussions by @kriskowal and @domenic. I have found references in issues concerning compositionality, e,g,\r\n\r\nhttps://github.com/kriskowal/q/issues/463\r\n\r\nAlso https://lists.w3.org/Archives/Public/www-dom/2013JulSep/0116.html mentions incompatibility with error handling and also with extensions to co-routines. However, I didn't come up with the original discussions.\r\n\r\nIMO (only partially informed so far) users had unrealistic expectations of the interface, and pushed it from being just notifications (like scoped events) to things which would interact with the promise chain as they bubbled. I'm specifically interested in decoupling from the intermediate chain, so all of that seems like (indeed) a bad idea, but also completely unnecessary. I don't understand what the issues are that domenic mentions, though."}}