1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-02-16 15:18:39 +00:00

fix: create reusable default profile pictures (#406)

Co-authored-by: Elias Schneider <login@eliasschneider.com>
This commit is contained in:
Kyle Mendell
2025-04-03 08:06:56 -05:00
committed by GitHub
parent 0d31c0ec6c
commit 734c6813ea
9 changed files with 166 additions and 46 deletions

View File

@@ -0,0 +1,27 @@
package job
import (
"log"
"github.com/go-co-op/gocron/v2"
"github.com/google/uuid"
)
func registerJob(scheduler gocron.Scheduler, name string, interval string, job func() error) {
_, err := scheduler.NewJob(
gocron.CronJob(interval, false),
gocron.NewTask(job),
gocron.WithEventListeners(
gocron.AfterJobRuns(func(jobID uuid.UUID, jobName string) {
log.Printf("Job %q run successfully", name)
}),
gocron.AfterJobRunsWithError(func(jobID uuid.UUID, jobName string, err error) {
log.Printf("Job %q failed with error: %v", name, err)
}),
),
)
if err != nil {
log.Fatalf("Failed to register job %q: %v", name, err)
}
}