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

go/epochtime: add WatchLatestEpoch method #2876

Merged
merged 1 commit into from
Apr 30, 2020

Conversation

ptrus
Copy link
Member

@ptrus ptrus commented Apr 29, 2020

Fixes: #2862

Pubsub framework is extended to support subscriptions based on bounded
ring channels. Bounded subscriptions are used in the new epochtime
WatchLatestEpoch method. The method is similar to the existing WatchEpochs
method, with the change that unread epochs get overridden with latest
epoch.

Registration worker is changed to use the WatchLatestEpoch method to
prevent trying to register for old epochs in case the worker falls
behind.

XXX: any other places where using a ring channel (e.g. skipping past/outdated channel items) would be preferable?

@ptrus ptrus force-pushed the ptrus/feature/pubsub-configurable-chan branch 3 times, most recently from 39a1654 to 472acad Compare April 29, 2020 14:28
@codecov
Copy link

codecov bot commented Apr 29, 2020

Codecov Report

Merging #2876 into master will increase coverage by 0.04%.
The diff coverage is 90.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2876      +/-   ##
==========================================
+ Coverage   67.62%   67.67%   +0.04%     
==========================================
  Files         344      344              
  Lines       33623    33652      +29     
==========================================
+ Hits        22739    22773      +34     
+ Misses       7974     7946      -28     
- Partials     2910     2933      +23     
Impacted Files Coverage Δ
go/epochtime/api/api.go 33.33% <ø> (ø)
go/epochtime/tests/mock_tester.go 82.97% <66.66%> (-5.60%) ⬇️
go/common/pubsub/pubsub.go 91.13% <100.00%> (+0.86%) ⬆️
go/consensus/tendermint/epochtime/epochtime.go 87.50% <100.00%> (+0.93%) ⬆️
...sensus/tendermint/epochtime_mock/epochtime_mock.go 73.61% <100.00%> (+0.94%) ⬆️
go/consensus/tendermint/keymanager/keymanager.go 86.74% <100.00%> (ø)
go/consensus/tendermint/registry/registry.go 66.92% <100.00%> (ø)
go/consensus/tendermint/roothash/roothash.go 67.90% <100.00%> (ø)
go/consensus/tendermint/scheduler/scheduler.go 78.30% <100.00%> (+1.88%) ⬆️
go/runtime/committee/nodes.go 80.39% <100.00%> (ø)
... and 32 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8642c9a...cbf0a60. Read the comment docs.

Copy link
Member

@kostko kostko left a comment

Choose a reason for hiding this comment

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

I think this looks good, just a minor cosmetic comment. I'll think about other use cases for ring channels, but that shouldn't block merging this PR.

go/common/pubsub/pubsub.go Outdated Show resolved Hide resolved
Pubsub framework is extended to support subscriptions based on bounded
ring channels. Bounded subscriptions are used in the new epochtime
WatchLatestEpoch method. The method is similar to the existing WatchEpochs
method, with the change that unread epochs get overridden with latest
epoch.

Registration worker is changed to use the WatchLatestEpoch method to
prevent trying to register for old epochs in case the worker falls
behind.
@ptrus ptrus force-pushed the ptrus/feature/pubsub-configurable-chan branch from 472acad to cbf0a60 Compare April 30, 2020 07:03
@ptrus ptrus merged commit 031766e into master Apr 30, 2020
@ptrus ptrus deleted the ptrus/feature/pubsub-configurable-chan branch April 30, 2020 07:47
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.

Registration worker can fall behind during initial sync
2 participants