1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-02-16 20:29:11 +00:00

feat: add daily heartbeat request for counting Pocket ID instances (#578)

This commit is contained in:
Elias Schneider
2025-05-28 11:19:45 +02:00
committed by GitHub
parent d29fca155e
commit e0ec607198
14 changed files with 123 additions and 47 deletions

View File

@@ -2,7 +2,6 @@ package job
import (
"context"
"log"
"github.com/pocket-id/pocket-id/backend/internal/service"
)
@@ -16,19 +15,7 @@ func (s *Scheduler) RegisterLdapJobs(ctx context.Context, ldapService *service.L
jobs := &LdapJobs{ldapService: ldapService, appConfigService: appConfigService}
// Register the job to run every hour
err := s.registerJob(ctx, "SyncLdap", "0 * * * *", jobs.syncLdap)
if err != nil {
return err
}
// Run the job immediately on startup
err = jobs.syncLdap(ctx)
if err != nil {
// Log the error only, but don't return it
log.Printf("Failed to sync LDAP: %v", err)
}
return nil
return s.registerJob(ctx, "SyncLdap", "0 * * * *", jobs.syncLdap, true)
}
func (j *LdapJobs) syncLdap(ctx context.Context) error {