implement scan and index queue

This commit is contained in:
ston1th 2022-10-06 18:42:10 +02:00
commit e0314dcf56
4 changed files with 81 additions and 33 deletions

View file

@ -166,7 +166,7 @@ func indexHandler(ctx *Context) {
if fpath, ok = hasTrimPrefix(path, core.IndexPrefix); ok {
log = log.WithValues("file", fpath)
log.V(2).Info("started indexing file")
err = scanFile(ctx.Srv, fpath)
err = ctx.Srv.SQ.Add(fpath)
if err != nil {
log.Error(err, "error indexing file")
}
@ -214,7 +214,7 @@ func indexHandler(ctx *Context) {
ctx.Srv.DB.IndexMutex.Set(uint64(len(files)))
for _, f := range files {
if !ctx.Srv.DB.IsIndexed(f) {
err := scanFile(ctx.Srv, f)
err := ctx.Srv.SQ.Add(f)
if err != nil {
log.Error(err, "error indexing file", "file", f)
}