1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-03-24 10:45:06 +00:00

Refactor RegisterJob signature and implement BackOff handling

Co-authored-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-05 17:55:25 +00:00
parent 881a2c64be
commit a42dc57358
10 changed files with 76 additions and 25 deletions

View File

@@ -34,11 +34,6 @@ const scimErrorBodyLimit = 4096
type scimSyncAction int
type Scheduler interface {
RegisterJob(ctx context.Context, name string, def gocron.JobDefinition, job func(ctx context.Context) error, runImmediately bool, extraOptions ...gocron.JobOption) error
RemoveJob(name string) error
}
const (
scimActionNone scimSyncAction = iota
scimActionCreated
@@ -149,7 +144,7 @@ func (s *ScimService) ScheduleSync() {
err := s.scheduler.RegisterJob(
context.Background(), jobName,
gocron.OneTimeJob(gocron.OneTimeJobStartDateTime(start)), s.SyncAll, false)
gocron.OneTimeJob(gocron.OneTimeJobStartDateTime(start)), s.SyncAll, RegisterJobOpts{RunImmediately: false})
if err != nil {
slog.Error("Failed to schedule SCIM sync", slog.Any("error", err))