From d3e82c0c5c2afd4c718abcc24521b8a1a0e3d7ff Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Sat, 10 Feb 2024 12:19:40 +0100 Subject: [PATCH] Possible error on scheduling profiling job is unchecked --- cmd/backup/main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/backup/main.go b/cmd/backup/main.go index d4df77c..ed59883 100644 --- a/cmd/backup/main.go +++ b/cmd/backup/main.go @@ -191,7 +191,7 @@ func (c *command) runInForeground(profileCronExpression string) error { } if profileCronExpression != "" { - cr.AddFunc(profileCronExpression, func() { + if _, err := cr.AddFunc(profileCronExpression, func() { memStats := runtime.MemStats{} runtime.ReadMemStats(&memStats) c.logger.Info( @@ -205,7 +205,9 @@ func (c *command) runInForeground(profileCronExpression string) error { "memory_heap_sys", formatBytes(memStats.HeapSys, false), ) - }) + }); err != nil { + return fmt.Errorf("runInForeground: error adding profiling job: %w", err) + } } var quit = make(chan os.Signal, 1)