diff --git a/cmd/cc-backend/main.go b/cmd/cc-backend/main.go index 3079b21..7f12ed1 100644 --- a/cmd/cc-backend/main.go +++ b/cmd/cc-backend/main.go @@ -28,7 +28,7 @@ import ( "github.com/ClusterCockpit/cc-backend/internal/metricdata" "github.com/ClusterCockpit/cc-backend/internal/repository" "github.com/ClusterCockpit/cc-backend/internal/tagger" - "github.com/ClusterCockpit/cc-backend/internal/taskManager" + "github.com/ClusterCockpit/cc-backend/internal/taskmanager" "github.com/ClusterCockpit/cc-backend/pkg/archive" "github.com/ClusterCockpit/cc-backend/web" ccconf "github.com/ClusterCockpit/cc-lib/ccConfig" @@ -326,7 +326,7 @@ func runServer(ctx context.Context) error { // Start archiver and task manager archiver.Start(repository.GetJobRepository(), ctx) - taskManager.Start(ccconf.GetPackageConfig("cron"), ccconf.GetPackageConfig("archive")) + taskmanager.Start(ccconf.GetPackageConfig("cron"), ccconf.GetPackageConfig("archive")) // Initialize web UI cfg := ccconf.GetPackageConfig("ui") @@ -365,7 +365,7 @@ func runServer(ctx context.Context) error { runtimeEnv.SystemdNotifiy(false, "Shutting down ...") srv.Shutdown(ctx) util.FsWatcherShutdown() - taskManager.Shutdown() + taskmanager.Shutdown() }() // Set GC percent if not configured diff --git a/internal/taskManager/commitJobService.go b/internal/taskManager/commitJobService.go index 8df29dd..87d2a3c 100644 --- a/internal/taskManager/commitJobService.go +++ b/internal/taskManager/commitJobService.go @@ -2,7 +2,7 @@ // All rights reserved. This file is part of cc-backend. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. -package taskManager +package taskmanager import ( "time" diff --git a/internal/taskManager/compressionService.go b/internal/taskManager/compressionService.go index e96115f..0abe167 100644 --- a/internal/taskManager/compressionService.go +++ b/internal/taskManager/compressionService.go @@ -2,7 +2,7 @@ // All rights reserved. This file is part of cc-backend. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. -package taskManager +package taskmanager import ( "time" @@ -16,7 +16,7 @@ import ( func RegisterCompressionService(compressOlderThan int) { cclog.Info("Register compression service") - s.NewJob(gocron.DailyJob(1, gocron.NewAtTimes(gocron.NewAtTime(05, 0, 0))), + s.NewJob(gocron.DailyJob(1, gocron.NewAtTimes(gocron.NewAtTime(0o5, 0, 0))), gocron.NewTask( func() { var jobs []*schema.Job @@ -27,10 +27,10 @@ func RegisterCompressionService(compressOlderThan int) { lastTime := ar.CompressLast(startTime) if startTime == lastTime { cclog.Info("Compression Service - Complete archive run") - jobs, err = jobRepo.FindJobsBetween(0, startTime) + jobs, err = jobRepo.FindJobsBetween(0, startTime, false) } else { - jobs, err = jobRepo.FindJobsBetween(lastTime, startTime) + jobs, err = jobRepo.FindJobsBetween(lastTime, startTime, false) } if err != nil { diff --git a/internal/taskManager/ldapSyncService.go b/internal/taskManager/ldapSyncService.go index 4a6e64a..47aaf64 100644 --- a/internal/taskManager/ldapSyncService.go +++ b/internal/taskManager/ldapSyncService.go @@ -2,7 +2,7 @@ // All rights reserved. This file is part of cc-backend. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. -package taskManager +package taskmanager import ( "time" diff --git a/internal/taskManager/retentionService.go b/internal/taskManager/retentionService.go index 440c369..b6ae633 100644 --- a/internal/taskManager/retentionService.go +++ b/internal/taskManager/retentionService.go @@ -2,7 +2,8 @@ // All rights reserved. This file is part of cc-backend. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. -package taskManager + +package taskmanager import ( "time" @@ -15,11 +16,11 @@ import ( func RegisterRetentionDeleteService(age int, includeDB bool) { cclog.Info("Register retention delete service") - s.NewJob(gocron.DailyJob(1, gocron.NewAtTimes(gocron.NewAtTime(04, 0, 0))), + s.NewJob(gocron.DailyJob(1, gocron.NewAtTimes(gocron.NewAtTime(0o4, 0, 0))), gocron.NewTask( func() { startTime := time.Now().Unix() - int64(age*24*3600) - jobs, err := jobRepo.FindJobsBetween(0, startTime) + jobs, err := jobRepo.FindJobsBetween(0, startTime, false) if err != nil { cclog.Warnf("Error while looking for retention jobs: %s", err.Error()) } @@ -42,11 +43,11 @@ func RegisterRetentionDeleteService(age int, includeDB bool) { func RegisterRetentionMoveService(age int, includeDB bool, location string) { cclog.Info("Register retention move service") - s.NewJob(gocron.DailyJob(1, gocron.NewAtTimes(gocron.NewAtTime(04, 0, 0))), + s.NewJob(gocron.DailyJob(1, gocron.NewAtTimes(gocron.NewAtTime(0o4, 0, 0))), gocron.NewTask( func() { startTime := time.Now().Unix() - int64(age*24*3600) - jobs, err := jobRepo.FindJobsBetween(0, startTime) + jobs, err := jobRepo.FindJobsBetween(0, startTime, false) if err != nil { cclog.Warnf("Error while looking for retention jobs: %s", err.Error()) } diff --git a/internal/taskManager/stopJobsExceedTime.go b/internal/taskManager/stopJobsExceedTime.go index a3743f6..d22f791 100644 --- a/internal/taskManager/stopJobsExceedTime.go +++ b/internal/taskManager/stopJobsExceedTime.go @@ -2,7 +2,7 @@ // All rights reserved. This file is part of cc-backend. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. -package taskManager +package taskmanager import ( "runtime" @@ -15,7 +15,7 @@ import ( func RegisterStopJobsExceedTime() { cclog.Info("Register undead jobs service") - s.NewJob(gocron.DailyJob(1, gocron.NewAtTimes(gocron.NewAtTime(03, 0, 0))), + s.NewJob(gocron.DailyJob(1, gocron.NewAtTimes(gocron.NewAtTime(0o3, 0, 0))), gocron.NewTask( func() { err := jobRepo.StopJobsExceedingWalltimeBy(config.Keys.StopJobsExceedingWalltime) diff --git a/internal/taskManager/taskManager.go b/internal/taskManager/taskManager.go index 35d6ea5..44a1c22 100644 --- a/internal/taskManager/taskManager.go +++ b/internal/taskManager/taskManager.go @@ -2,7 +2,7 @@ // All rights reserved. This file is part of cc-backend. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. -package taskManager +package taskmanager import ( "bytes" diff --git a/internal/taskManager/updateDurationService.go b/internal/taskManager/updateDurationService.go index 1d98756..43fbb54 100644 --- a/internal/taskManager/updateDurationService.go +++ b/internal/taskManager/updateDurationService.go @@ -2,7 +2,7 @@ // All rights reserved. This file is part of cc-backend. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. -package taskManager +package taskmanager import ( "time" diff --git a/internal/taskManager/updateFootprintService.go b/internal/taskManager/updateFootprintService.go index 9d2d43b..89914e7 100644 --- a/internal/taskManager/updateFootprintService.go +++ b/internal/taskManager/updateFootprintService.go @@ -2,7 +2,7 @@ // All rights reserved. This file is part of cc-backend. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. -package taskManager +package taskmanager import ( "context"