What happens if i reject / resolve multiple times in Kriskowal’s q?

Since promises can only resolve once (to either fulfilled or rejected), the first resolution wins and any further calls will be ignored. From the docs:

In all cases where a promise is resolved (i.e. either fulfilled or rejected), the resolution is permanent and cannot be reset. Attempting to call resolve, reject, or notify if promise is already resolved will be a no-op.

Should i avoid to call reject/resolve multiple times?

You can even design your application letting two methods “race” against each other to resolve a deferred, but in general it should be avoided to reduce confusion of a reader.

Leave a Comment