Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid race conditions on patch replenishment #218

Merged
merged 2 commits into from
Jun 12, 2024
Merged

Avoid race conditions on patch replenishment #218

merged 2 commits into from
Jun 12, 2024

Conversation

glopesdev
Copy link
Contributor

This PR resolves two critical edge cases with patch replenishment:

  1. Threshold crossing was using WithLatestFrom to get the current patch threshold. This means patch threshold transitions had to wait for a sample arriving from the wheel. This created a race between the block transition and local patch transition notifications. Changing the operator to CombineLatest ensures patch transition to NaN is synchronized and strictly preceding block transition.
  2. If NaN threshold values end up in state recovery, it was impossible to resume patch operation since the sequence would never subscribe, and therefore could not be terminated to sample a new threshold. With the new synchronized patch transition behavior, this guard became unnecessary, and was removed.

@glopesdev glopesdev added the fix Pull request that fixes an issue label Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Pull request that fixes an issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants