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.defer is deprecated warning #40

Closed
kamil-cf opened this issue Sep 23, 2019 · 5 comments
Closed

Promise.defer is deprecated warning #40

kamil-cf opened this issue Sep 23, 2019 · 5 comments
Assignees
Labels

Comments

@kamil-cf
Copy link

Problem:
While running an app based on comedy framework we're getting an error:

Warning: Promise.defer is deprecated and will be removed in a future version. Use new Promise instead.
  at P (/home/node/work/node_modules/comedy/lib/forked-actor.js:433:25)
  From previous event:
  at ForkedActorChild._send0 (/home/node/work/node_modules/comedy/lib/forked-actor.js:421:12)
  at ForkedActorChild._pingParent (/home/node/work/node_modules/comedy/lib/forked-actor-child.js:105:17)
  at Timeout.setInterval [as _onTimeout] (/home/node/work/node_modules/comedy/lib/forked-actor-child.js:44:16)
  at ontimeout (timers.js:436:11)
  at tryOnTimeout (timers.js:300:5)
  at listOnTimeout (timers.js:263:5)
  at Timer.processTimers (timers.js:223:10)

Source:
/lib/forked-actor.js, method _send0 (https://github.com/untu/comedy/blob/master/lib/forked-actor.js#L433)

I think that the main issue here is how do you use Bluebird library. According to https://github.com/petkaantonov/bluebird/wiki/Promise-anti-patterns#the-deferred-anti-pattern you should not use defer and pending methods on P object.

Expected behavior:
No warning in a console.

@weekens weekens self-assigned this Sep 27, 2019
@weekens weekens added the bug label Sep 27, 2019
@weekens
Copy link
Contributor

weekens commented Sep 27, 2019

@kamil-cf Thanks for your report! Will handle this in nearset time.

@weekens
Copy link
Contributor

weekens commented Sep 27, 2019

Fixing this in #42

@weekens
Copy link
Contributor

weekens commented Sep 27, 2019

Honestly, I failed to reproduce this warning with https://github.com/untu/comedy-examples. However, I removed all Promise.defer() and Promise.pending() from production code. Promise.defer() is only left in tests for now.

Anyway, if you could send me a small reproducing example or just check if the problem is fixed on your side, it would be nice!

@kamil-cf
Copy link
Author

Hey, I've checked and it seems to be working fine! No warnings so far. Can you please release a new version on npm?

@weekens
Copy link
Contributor

weekens commented Sep 28, 2019

@weekens weekens closed this as completed Sep 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants