all repos — searchix @ d6d0bf3856234f06ca5707df6c760904255bef08

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

feat: remove entities not present in current import

Alan Pearce
commit

d6d0bf3856234f06ca5707df6c760904255bef08

parent

f896b6861faae07485b8f7bee2e9b607527882c1

1 file changed, 12 insertions(+), 1 deletion(-)

changed files
M internal/importer/job.gointernal/importer/job.go
@@ -27,7 +27,7 @@ Job.LastRun.FinishedAt = time.Now()
Job.StartedAt = time.Time{} } -func MarkLastFetch(meta *index.Meta) { +func MarkLastRun(meta *index.Meta) { meta.LastImport = Job.LastRun }
@@ -81,8 +81,19 @@ } else {
imp.options.Logger.Info("indexing complete") } + err = imp.Prune(ctx) + if err != nil { + imp.options.Logger.Warn("error pruning index", "error", err) + } + cancel() MarkImportFinished() + + MarkLastRun(imp.options.WriteIndex.Meta) + err = imp.options.WriteIndex.SaveMeta() + if err != nil { + imp.options.Logger.Error("error saving metadata", "error", err) + } nextRun = nextUTCOccurrenceOfTime(imp.config.Importer.UpdateAt) SetNextRun(nextRun)