This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stopping a ticker after the first tick before this change was a no-op since the Ticker’s moment ID was not updated.
Uh,
|
This change adds a do method for timer (similar to ticker’s do method). It also adds a test case to verifies that backwards compatibility is preserved for a quirk in the current Observe and ticker implementation. That is, a tick triggers the observeUnlocked method. I’m not aware of any piece of code actually relying on this behavior, but it’s better to change that separately if we want to. Additionally, we introduce a small convention for Time’s methods: if the method does not acquire the lock, it has Unlocked suffix. A notable exception is the do method on timer and ticker that is expected to run under Time’s lock when scheduled temporal effects are triggered.
Pull Request Test Coverage Report for Build 1625591901
💛 - Coveralls |
I’ve added |
tie
force-pushed
the
fix-ticker-stop
branch
2 times, most recently
from
December 27, 2021 02:33
49df95d
to
8e7d13d
Compare
This change avoid creating a new moment for each Ticker’s tick but still maintains backwards compatibility for tick observeration. It also fixes an accidentally introduced data race for id field between Reset and do methods in ticker.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR
@ernado, not sure if the first point was an intentional behavior. I don’t think there are other public projects that use neo (see pkg.go.dev), so perhaps we can fix it in a separate PR if td tests do not rely on this quirk?