all repos — searchix @ 6984d4d32ab506494394f8a6a8aa18041c45b9e8

Search engine for NixOS, nix-darwin, home-manager and NUR users

feat: re-index on startup if last run > 24 hours ago

Alan Pearce
commit

6984d4d32ab506494394f8a6a8aa18041c45b9e8

parent

41d40588457290477d87346a133be72be6c621cb

1 file changed, 8 insertions(+), 2 deletions(-)

changed files
M internal/importer/main.gointernal/importer/main.go
@@ -300,7 +300,13 @@ CheckInMargin: 5,
Timezone: time.Local.String(), } - nextRun := nextUTCOccurrenceOfTime(imp.config.Importer.UpdateAt) + var nextRun time.Time + if Job.FinishedAt.Before(time.Now().Add(-24 * time.Hour)) { + imp.log.Info("indexing last ran more than 24 hours ago, scheduling immediate update") + nextRun = time.Now() + } else { + nextRun = nextUTCOccurrenceOfTime(imp.config.Importer.UpdateAt) + } SetNextRun(nextRun) for { imp.log.Debug("scheduling next run", "next-run", nextRun)
@@ -338,7 +344,7 @@ MonitorSlug: monitorSlug,
Status: sentry.CheckInStatusOK, }, monitorConfig) } - nextRun = nextRun.AddDate(0, 0, 1) + nextRun = nextUTCOccurrenceOfTime(imp.config.Importer.UpdateAt) MarkIndexingFinished(nextRun) } })