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

closedts: react faster to config changes #35203

Merged
merged 1 commit into from
Feb 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pkg/storage/closedts/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ func (p *Provider) runCloser(ctx context.Context) {
ch := p.Notify(p.cfg.NodeID)
defer close(ch)

confCh := make(chan struct{}, 1)
confChanged := func() {
select {
case confCh <- struct{}{}:
default:
}
}
closedts.TargetDuration.SetOnChange(&p.cfg.Settings.SV, confChanged)

var t timeutil.Timer
defer t.Stop()
var lastEpoch ctpb.Epoch
Expand All @@ -134,6 +143,9 @@ func (p *Provider) runCloser(ctx context.Context) {
return
case <-t.C:
t.Read = true
case <-confCh:
// Loop around to use the updated timer.
continue
}

next, epoch, err := p.cfg.Clock(p.cfg.NodeID)
Expand Down