-
Notifications
You must be signed in to change notification settings - Fork 347
Fix event monitor panic. #701
Fix event monitor panic. #701
Conversation
|
LGTM |
1 similar comment
|
LGTM |
Signed-off-by: Lantao Liu <[email protected]>
b1a1dc9 to
277edb2
Compare
|
|
||
| type backOff struct { | ||
| queuePool map[string]*backOffQueue | ||
| queuePool map[string]*backOffQueue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go fmt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is gofmt result.
mikebrow
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See nit/comment.
| defer b.tickerMu.Unlock() | ||
| if b.ticker != nil { | ||
| b.ticker.Stop() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else...logrus.WithError(err).Error("attempt to stop ticker before start has completed allocating the ticker")
note: should be impossible for this to happen now that you have a mutex... if the log is impossible we don't need the nil check..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is possible, user may CTRL+C before CRI service starts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user interrupts ... interesting thx
| return nil, errors.New("event channel is nil") | ||
| } | ||
| closeCh := make(chan struct{}) | ||
| backOffCheckCh := em.backOff.start() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good!
|
/lgtm |
mikebrow
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/LGTM
Fix the event monitor panic.
We should only stop ticker when it is not nil.
Since
startandstopcan be called at the same time, we need a lock to protect it.Signed-off-by: Lantao Liu [email protected]