From d37784f4cc051f5db066cfc03ec146a2f3c2ba91 Mon Sep 17 00:00:00 2001 From: Kroexov Date: Fri, 26 Jan 2024 16:08:37 +0300 Subject: [PATCH] Fix indexer in case file not downloaded --- indexer.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/indexer.go b/indexer.go index f0e325a..e177957 100644 --- a/indexer.go +++ b/indexer.go @@ -248,6 +248,10 @@ func (hi HashIndexer) ProcessQueue(ctx context.Context) error { list[i].IndexedAt = &now info, err := hi.IndexFile(ns, NewFileHash(v.Hash, v.Extension).File()) if err != nil { + if errors.Is(err, os.ErrNotExist) { + // skip in case file not found (not downloaded yet) + list[i].IndexedAt = nil + } list[i].Error = err.Error() continue } @@ -266,6 +270,7 @@ func (hi HashIndexer) ProcessQueue(ctx context.Context) error { db.Columns.VfsHash.Width, db.Columns.VfsHash.IndexedAt, db.Columns.VfsHash.Blurhash, + db.Columns.VfsHash.Error, ). Update() return err