Skip to content

Fix lazy evaluation pattern in rate limit decay#15

Merged
andygolay merged 3 commits intomainfrom
fix-lazy-evaluation-pattern
Dec 1, 2025
Merged

Fix lazy evaluation pattern in rate limit decay#15
andygolay merged 3 commits intomainfrom
fix-lazy-evaluation-pattern

Conversation

@andygolay
Copy link
Copy Markdown
Collaborator

@andygolay andygolay commented Nov 28, 2025

Fix lazy evaluation pattern in rate limit decay (problem 2 in https://www.notion.so/movementlabs/OFT-issues-2ae18675b2d780af9013ee9082afccdd)

  • Remove min() cap on elapsed time calculation in in_flight_at_time to allow decay to continue beyond one window, preventing in_flight_on_last_update from getting stuck above the limit when the limit is lowered
  • Clean up Move warnings

@andygolay andygolay force-pushed the fix-lazy-evaluation-pattern branch from 906d1e3 to 4f52b70 Compare November 30, 2025 21:01
@andygolay andygolay marked this pull request as ready for review November 30, 2025 21:08
@andygolay andygolay changed the title Fix lazy evaluation pattern Fix lazy evaluation pattern in rate limit decay Nov 30, 2025
Copy link
Copy Markdown
Collaborator

@rubujubi rubujubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding this commit 4f52b70

Just want to confirm that we allow rate_limit.in_flight_on_last_update to be greater than rate_limit.limit right? Then it makes sense to remove the cap here.

My current understanding is that when rate_limit.limit is suddenly lowered the current fix can let rate_limit.in_flight_on_last_update decay proportionally to the updated rate_limit.limit instead of getting stuck, however having a lower limit still make the process slow, and if we want to speed up the process we should increase the limit.

@andygolay
Copy link
Copy Markdown
Collaborator Author

Regarding this commit 4f52b70

Just want to confirm that we allow rate_limit.in_flight_on_last_update to be greater than rate_limit.limit right? Then it makes sense to remove the cap here.

My current understanding is that when rate_limit.limit is suddenly lowered the current fix can let rate_limit.in_flight_on_last_update decay proportionally to the updated rate_limit.limit instead of getting stuck, however having a lower limit still make the process slow, and if we want to speed up the process we should increase the limit.

@rubujubi yes, we could increase the limit to speed it up if needed.

@andygolay andygolay requested a review from rubujubi December 1, 2025 04:12
@andygolay andygolay merged commit 641629e into main Dec 1, 2025
0 of 6 checks passed
@andygolay andygolay deleted the fix-lazy-evaluation-pattern branch December 1, 2025 04:30
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