Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Improve HotDataFlow behavior (EXPOSUREAPP-3777) #1612

Merged
merged 3 commits into from
Nov 16, 2020

Conversation

d4rken
Copy link
Member

@d4rken d4rken commented Nov 16, 2020

  • Prevent re-execution of past submissions when the observable goes cold.
  • Guard internal value updates with a mutex in case the value update is not as thread-safe as we think it is.

* Prevent re-execution of past submissions when the observable goes cold.
* Guard internal value updates with a mutex in case the value update is not as thread-safe as we think it is.
@d4rken d4rken added bug Something isn't working maintainers Tag pull requests created by maintainers labels Nov 16, 2020
@d4rken d4rken added this to the 1.6.0 milestone Nov 16, 2020
@d4rken d4rken requested a review from a team November 16, 2020 11:48
@d4rken d4rken added the prio PRs to review first. label Nov 16, 2020
Timber.tag(tag).v("updateActions resetReplayCache().")
updateActions.resetReplayCache()
}
.collect { updateAction ->
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm suspicious that our access of currentValue in .collect { } was not thread-safe, which is why I added the mutex.

updateActions
.onCompletion {
Timber.tag(tag).v("updateActions resetReplayCache().")
updateActions.resetReplayCache()
Copy link
Member Author

@d4rken d4rken Nov 16, 2020

Choose a reason for hiding this comment

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

When we unsubscribe, and the HotDataFlow goes cold, and then resubscribe, we would replay all previous update actions on the new value.

I don't think this affected the current issue, but it's a bug nonetheless. We should reset the cache here to prevent the actions from being replayed.

@harambasicluka harambasicluka modified the milestones: 1.6.0, 1.6.1 Nov 16, 2020
@chiljamgossow chiljamgossow self-assigned this Nov 16, 2020
ralfgehrer
ralfgehrer previously approved these changes Nov 16, 2020
@d4rken d4rken dismissed stale reviews from chiljamgossow and ralfgehrer via 66de9d1 November 16, 2020 13:36
@sonarcloud
Copy link

sonarcloud bot commented Nov 16, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

81.2% 81.2% Coverage
0.0% 0.0% Duplication

@BMItr BMItr self-assigned this Nov 16, 2020
Copy link
Contributor

@BMItr BMItr left a comment

Choose a reason for hiding this comment

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

Code lgtm. Test are running fine now.

@d4rken d4rken merged commit 0f866e5 into release/1.6.x Nov 16, 2020
@d4rken d4rken deleted the fix/guard-value-update-in-hotdataflow branch November 16, 2020 13:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working maintainers Tag pull requests created by maintainers prio PRs to review first.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants