question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scheduler.asap doesn't use `nextTick`?

See original GitHub issue

RxJS version:

5.4.0

Code to reproduce:

process.nextTick(() => { console.log('nextTick 1'); });
setImmediate(() => { console.log('setImmediate 1'); });
Observable.of('now!', Scheduler.asap).subscribe(x => console.log(x));
setImmediate(() => { console.log('setImmediate 2'); });
process.nextTick(() => { console.log('nextTick 2'); });

Expected behavior:

"nextTick 1"
"now!"
"nextTick 2"
"setImmediate 1"
"setImmediate 2"

Actual behavior:

"nextTick 1"
"nextTick 2"
"setImmediate 1"
"now!"
"setImmediate 2"

Additional information:

Am I misunderstanding something? I reached for the asap scheduler because the docs say it’s supposed to schedule using nextTick (when available), but it doesn’t appear to be doing so.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
trxcllntcommented, May 22, 2017

@benlesh I think what @matthewwithanm is pointing out is that setImmediate isn’t the microtask scheduling method (see here). Furthermore, setImmediate docs on MDN seem to indicate setImmediate is dead, so we should probably find an alternative.

1reaction
trxcllntcommented, May 16, 2017

@matthewwithanm hey Matt, sorry for the confusion. The asap scheduler attempts to use setImmediate, and falls back to nextTick if it isn’t available (you can see how it’s resolved here). Let me know if you have any suggestions on a better approach.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RxJS Working with Scheduler - Javatpoint
An RxJS Scheduler is a way to control the timing strategy used to execute tasks in RxJS apps or reactive applications ... nextTick,...
Read more >
node.js - RxJS Schedulers - Stack Overflow
It doesn't use setImmediate, but Promise.then . Since it won't go to the next tick until the microtasks queue is empty, I think...
Read more >
<Lazy> rendering in Vue to improve performance - Medium
It's just two levels of scheduling: ASAP and “a bit later” and for the ... Only this time we'll use a bit more...
Read more >
How to Use nextTick() in Vue - Dmitri Pavlutin
nextTick (callback) . It executes callback right after the new data updates have reached DOM.
Read more >
eggheadio-projects/step-by-step-async-javascript-with-rxjs: null
By default subscription to Observable calls `func` * synchronously, but using `Scheduler.async` as last parameter will defer call to input function, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found