Skip to content

Fixes Refractory Timer - #159

Merged
micahwoodard merged 1 commit into
mainfrom
fix-refractory-timer
Aug 25, 2026
Merged

Fixes Refractory Timer#159
micahwoodard merged 1 commit into
mainfrom
fix-refractory-timer

Conversation

@micahwoodard

Copy link
Copy Markdown
Collaborator

Looking closer at the refectory period again, I saw a bug where even though the time sampled is different each draw, the timer is terminating on the first drawn interval. So for a session like this, even though all of the times are different, the timer only waits for 1.7 each time

image

Fixed by adding timer into defer group

@bruno-f-cruz

bruno-f-cruz commented Aug 25, 2026

Copy link
Copy Markdown
Member

For future reference (I did not appreciate this detail myself). Repeat overloads the Repeat Rx operator. This means it simply resubscribes to the original observable. Timer sets its due time on Generate. So, when Repeat is trigger, the Generate doesn't run and you inherit whatever property was already there at the observable creation (the first time it was created). To get around this, we use Defer/SelectMany that actually CREATES a new observable and sets a new due time each time.

@micahwoodard
micahwoodard merged commit ee1272d into main Aug 25, 2026
4 checks passed
@micahwoodard
micahwoodard deleted the fix-refractory-timer branch August 25, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants