From 31d080d9095548aa53938ed4105597aff2a6c3fc Mon Sep 17 00:00:00 2001 From: glendsoza Date: Mon, 17 Jan 2022 21:54:07 +0530 Subject: [PATCH] Changes as per review --- pkg/commands/docker.go | 1 - pkg/config/app_config.go | 6 ++++++ pkg/gui/gui.go | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/commands/docker.go b/pkg/commands/docker.go index 2433162b..2c76d4e2 100644 --- a/pkg/commands/docker.go +++ b/pkg/commands/docker.go @@ -467,7 +467,6 @@ func (c *DockerCommand) RefreshImages() error { ownImages := make([]*Image, len(images)) for i, image := range images { - // func (cli *Client) ImageHistory(ctx context.Context, imageID string) ([]image.HistoryResponseItem, error) firstTag := "" tags := image.RepoTags diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go index 0ede0554..8f4be0ac 100644 --- a/pkg/config/app_config.go +++ b/pkg/config/app_config.go @@ -197,6 +197,11 @@ type UpdateConfig struct { // It expects a valid duration like: 100ms, 2s, 200ns // for docs see: https://golang.org/pkg/time/#ParseDuration DockerRefreshInterval time.Duration `yaml:"dockerRefreshInterval,omitempty"` + + // ImageRefreshInterval determines the time betweens updates of docker images + // It expects a valid duration like: 100ms, 2s, 200ns + // for docs see: https://golang.org/pkg/time/#ParseDuration + ImageRefreshInterval time.Duration `yaml:"imageRefreshInterval,omitempty"` } // GraphConfig specifies how to make a graph of recorded container stats @@ -398,6 +403,7 @@ func GetDefaultConfig() UserConfig { OS: GetPlatformDefaultConfig(), Update: UpdateConfig{ DockerRefreshInterval: time.Millisecond * 100, + ImageRefreshInterval: time.Millisecond * 30000, }, Stats: StatsConfig{ MaxDuration: duration, diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 9d1e5085..0009447c 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -241,12 +241,13 @@ func (gui *Gui) Run() error { gui.waitForIntro.Add(1) dockerRefreshInterval := gui.Config.UserConfig.Update.DockerRefreshInterval + imageRefeshInterval := gui.Config.UserConfig.Update.ImageRefreshInterval go func() { gui.waitForIntro.Wait() gui.goEvery(time.Millisecond*30, gui.reRenderMain) gui.goEvery(dockerRefreshInterval, gui.refreshProject) gui.goEvery(dockerRefreshInterval, gui.refreshContainersAndServices) - gui.goEvery(time.Millisecond*30000, gui.refreshImages) + gui.goEvery(imageRefeshInterval, gui.refreshImages) gui.goEvery(dockerRefreshInterval, gui.refreshVolumes) gui.goEvery(time.Millisecond*1000, gui.DockerCommand.UpdateContainerDetails) gui.goEvery(time.Millisecond*1000, gui.checkForContextChange)