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.

Observable.timer unexpected/undocumented for large timeouts

See original GitHub issue

RxJS version: 5.5.2

Code to reproduce:

Rx.Observable
    .timer(new Date(2017, 10, 28))
    .subscribe(() => {
        console.log('Immediate emit');
    });

Expected behavior: Should emit about a month from today (Oct 27, 2017).

Actual behavior: Emits immediately.

Additional information: I gather the timers has a max value of 2147483647 (2^31-1), and it makes sense to have such a limitation, but I would suggest an argument check and/or a warning or note in the documentation. An error seems justified as I cannot imagine someone passing in a value greater than that an expecting a 1 ms timeout.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:11
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
rohiievychcommented, Aug 3, 2018

Here is a workaround for large timeouts: timer().pipe(delay(timeout))

5reactions
benleshcommented, Oct 31, 2017

We could test to see if it’s more than 2147483647, and if so, schedule an interval… basically something like this:

if (ms > 2147483647) {
  const MAX = 2147483647;
  const n = Math.floor(ms / MAX)
  const r = ms % MAX;
  return concat(timer(MAX, MAX).pipe(take(n)), timer(r)).pipe(takeLast());
} else {
  // usual timer path here.
}

I mean we could make it work… I’d probably do something more efficient than whats up there. A setInterval with a counter or something. Or add support directly to the AsapScheduler.

However it seems like it would be really weird for someone to want to do this, and they could just as easily do what I did above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Observable Timer for screen timeout android - rx java
Sets Timeout. It throws TimeoutException , when there is no emitted item for specified amount of time ( TIMEOUT_INTERVAL ). Timer is started ......
Read more >
BIG-IP 13.1.1.5 Fixes and Known Issues - AskF5 - F5 Networks
Since non-violating traffic is not sent to the policy engine, the inactivity timeout timer is never reset, which will eventually lead to suggestions...
Read more >
Consolidated JDK 8 Release Notes - Oracle
Consolidated Release Notes for JDK 8 and JDK 8 Update Releases. BPR builds are available only as commercial offerings to Oracle customers.
Read more >
The Ultimate Guide to Android Bluetooth Low Energy
Unfortunately, the Android SDK's BLE API is full of undocumented ... has a high enough advertising interval that it doesn't overlap with the ......
Read more >
Bug listing with status RESOLVED with resolution OBSOLETE ...
_rc78 with USE=ipc: ebuild-ipc timed out if bashrcng shmfs-plugin is enabled. ... Bug:395681 - "kernel: kvm: pit timer with no irqchip crashes the...
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