ReactiveX / ReactiveX/rxjs

Observable.timer unexpected/undocumented for large timeouts

Open
#3,015 13 comments 14 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
31.7k
Forks
3k
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported behavior with the Observable.timer call shown in the issue, then trace the Observable.timer implementation and its timeout scheduling path. Confirm how large date-based delays are handled and update the relevant behavior or documentation so the result is explicit and covered by a regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.