Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions advanceable.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ func (a *advanceable) setCurrent(now time.Time) {

// register marks a subscriber to be updated when the current time changes.
func (a *advanceable) register(subscriber subscriber) {
a.m.Lock()
a.subscribers = append(a.subscribers, subscriber)
a.m.Unlock()

a.cond.Broadcast()
}
3 changes: 2 additions & 1 deletion mock_clock.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ func (c *MockClock) Now() time.Time {
// clock's internal time is at or past the supplied duration.
func (c *MockClock) After(duration time.Duration) <-chan time.Time {
c.m.Lock()
defer c.m.Unlock()

c.afterArgs = append(c.afterArgs, duration)
c.m.Unlock()

if duration <= 0 {
return closedChan
Expand Down
2 changes: 0 additions & 2 deletions mock_timer.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,12 @@ func newMockTimerAt(
panic("duration cannot be 0")
}

advanceable.m.Lock()
t := &MockTimer{
advanceable: advanceable,
deadline: advanceable.now.Add(duration),
ch: make(chan time.Time),
f: f,
}
advanceable.m.Unlock()

go t.process()
advanceable.register(t)
Expand Down