From e56c5f30e0797cebe9f84a102de64a2d0ad2f114 Mon Sep 17 00:00:00 2001 From: theRealBassist Date: Mon, 19 Aug 2024 15:29:50 -0400 Subject: [PATCH 1/2] Fixes edge cases where container health message does not have expected suffix --- beszel/internal/agent/agent.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/beszel/internal/agent/agent.go b/beszel/internal/agent/agent.go index af830b3..7f443f9 100644 --- a/beszel/internal/agent/agent.go +++ b/beszel/internal/agent/agent.go @@ -190,8 +190,9 @@ func (a *Agent) getDockerStats() ([]*container.Stats, error) { ctr.IdShort = ctr.Id[:12] validIds[ctr.IdShort] = struct{}{} // check if container is less than 1 minute old (possible restart) + // also check if container health is listed as starting to catch potential boot loops // note: can't use Created field because it's not updated on restart - if strings.HasSuffix(ctr.Status, "seconds") { + if strings.Contains(ctr.Status, "seconds") || strings.Contains(ctr.Status, "starting") { // if so, remove old container data a.deleteContainerStatsSync(ctr.IdShort) } From 7e1455161d7d77659d589a2bd5ad34a1811d90d0 Mon Sep 17 00:00:00 2001 From: Henry Dollman Date: Tue, 20 Aug 2024 14:23:24 -0400 Subject: [PATCH 2/2] update container status check --- beszel/internal/agent/agent.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/beszel/internal/agent/agent.go b/beszel/internal/agent/agent.go index b0823c1..3e3fd28 100644 --- a/beszel/internal/agent/agent.go +++ b/beszel/internal/agent/agent.go @@ -191,9 +191,8 @@ func (a *Agent) getDockerStats() ([]*container.Stats, error) { ctr.IdShort = ctr.Id[:12] validIds[ctr.IdShort] = struct{}{} // check if container is less than 1 minute old (possible restart) - // also check if container health is listed as starting to catch potential boot loops // note: can't use Created field because it's not updated on restart - if strings.Contains(ctr.Status, "seconds") || strings.Contains(ctr.Status, "starting") { + if strings.Contains(ctr.Status, "second") { // if so, remove old container data a.deleteContainerStatsSync(ctr.IdShort) }