mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
slightly more responsive
This commit is contained in:
parent
9db6eeac9d
commit
3c9437f801
1 changed files with 47 additions and 43 deletions
|
|
@ -178,6 +178,11 @@ func (gui *Gui) renderContainerLogs(container *commands.Container) error {
|
|||
mainView.Wrap = gui.Config.UserConfig.Gui.WrapMainPanel
|
||||
|
||||
return gui.T.NewTickerTask(time.Millisecond*200, nil, func(stop, notifyStopped chan struct{}) {
|
||||
gui.renderContainerLogsAux(container, stop, notifyStopped)
|
||||
})
|
||||
}
|
||||
|
||||
func (gui *Gui) renderContainerLogsAux(container *commands.Container, stop, notifyStopped chan struct{}) {
|
||||
gui.clearMainView()
|
||||
|
||||
command := utils.ApplyTemplate(
|
||||
|
|
@ -210,12 +215,13 @@ func (gui *Gui) renderContainerLogs(container *commands.Container) error {
|
|||
|
||||
// if we are here because the task has been stopped, we should return
|
||||
// if we are here then the container must have exited, meaning we should wait until it's back again before
|
||||
L:
|
||||
ticker := time.NewTicker(time.Millisecond * 100)
|
||||
defer ticker.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-stop:
|
||||
return
|
||||
default:
|
||||
case <-ticker.C:
|
||||
result, err := container.Inspect()
|
||||
if err != nil {
|
||||
// if we get an error, then the container has probably been removed so we'll get out of here
|
||||
|
|
@ -224,12 +230,10 @@ func (gui *Gui) renderContainerLogs(container *commands.Container) error {
|
|||
return
|
||||
}
|
||||
if result.State.Running {
|
||||
break L
|
||||
}
|
||||
time.Sleep(time.Millisecond * 100)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func (gui *Gui) refreshContainersAndServices() error {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue