refactor: move API key cleanup job to actor (#1687)

This commit is contained in:
Alessandro (Ale) Segala
2026-08-15 00:39:02 +02:00
committed by GitHub
parent 6fba970159
commit 2dc062ac0f
12 changed files with 303 additions and 147 deletions
@@ -14,10 +14,6 @@ func registerScheduledJobs(ctx context.Context, db *gorm.DB, svc *services, sche
if err != nil {
return fmt.Errorf("failed to register DB cleanup jobs in scheduler: %w", err)
}
err = scheduler.RegisterApiKeyExpiryJob(ctx, svc.apiKeyModule, svc.appConfigService, svc.emailModule)
if err != nil {
return fmt.Errorf("failed to register API key expiration jobs in scheduler: %w", err)
}
err = scheduler.RegisterScimJobs(ctx, svc.scimService)
if err != nil {
return fmt.Errorf("failed to register SCIM scheduler job: %w", err)
@@ -170,8 +170,12 @@ func initServices(
}
svc.apiKeyModule, err = apikey.New(ctx, apikey.Dependencies{
DB: db,
StaticApiKey: common.EnvConfig.StaticApiKey,
DB: db,
Actors: actors,
StaticApiKey: common.EnvConfig.StaticApiKey,
AppConfig: svc.appConfigService,
EmailSender: svc.emailModule,
CleanupDisabled: common.EnvConfig.AppEnv.IsTest(),
})
if err != nil {
return nil, fmt.Errorf("failed to create API key module: %w", err)