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
|
mainView.Wrap = gui.Config.UserConfig.Gui.WrapMainPanel
|
||||||
|
|
||||||
return gui.T.NewTickerTask(time.Millisecond*200, nil, func(stop, notifyStopped chan struct{}) {
|
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()
|
gui.clearMainView()
|
||||||
|
|
||||||
command := utils.ApplyTemplate(
|
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 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
|
// 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 {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-stop:
|
case <-stop:
|
||||||
return
|
return
|
||||||
default:
|
case <-ticker.C:
|
||||||
result, err := container.Inspect()
|
result, err := container.Inspect()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// if we get an error, then the container has probably been removed so we'll get out of here
|
// 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
|
return
|
||||||
}
|
}
|
||||||
if result.State.Running {
|
if result.State.Running {
|
||||||
break L
|
return
|
||||||
}
|
}
|
||||||
time.Sleep(time.Millisecond * 100)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) refreshContainersAndServices() error {
|
func (gui *Gui) refreshContainersAndServices() error {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue