mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-24 16:11:04 +00:00
Fix: race condition for pause/unpause state
This commit is contained in:
parent
78edbf3d2e
commit
bf5cd9f9f0
1 changed files with 12 additions and 0 deletions
|
|
@ -363,6 +363,18 @@ outer:
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return
|
return
|
||||||
case message := <-messageChan:
|
case message := <-messageChan:
|
||||||
|
switch message.Type {
|
||||||
|
case events.ContainerEventType:
|
||||||
|
switch message.Action {
|
||||||
|
case events.ActionPause, events.ActionUnPause:
|
||||||
|
// pause/unpause events are lonely events
|
||||||
|
// add tiny delay to allow state to stabilise
|
||||||
|
// other events don't need that as they are followed by other events
|
||||||
|
// which give time for state to stabilise and be picked up by our refreshes
|
||||||
|
time.Sleep(200 * time.Millisecond)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// We could be more granular about what events should trigger which refreshes.
|
// We could be more granular about what events should trigger which refreshes.
|
||||||
// At the moment it's pretty efficient though, and it might not be worth
|
// At the moment it's pretty efficient though, and it might not be worth
|
||||||
// the maintenance burden of mapping specific events to specific refreshes
|
// the maintenance burden of mapping specific events to specific refreshes
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue