diff options
author | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-06-24 00:06:47 +0200 |
---|---|---|
committer | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2023-06-24 00:06:47 +0200 |
commit | 5bb3d3ecabfc658035e69d5d5286cabaf44e3f73 (patch) | |
tree | ed13377099c8b451acc5553e370e54cfee2a44ef /cmd/server/main.go | |
parent | 1d6fa60b3c60d068d12b19f10f5ad73e836b5a70 (diff) | |
download | lens-5bb3d3ecabfc658035e69d5d5286cabaf44e3f73.tar.gz lens-5bb3d3ecabfc658035e69d5d5286cabaf44e3f73.tar.bz2 lens-5bb3d3ecabfc658035e69d5d5286cabaf44e3f73.zip |
feat: Add log to list list processor
Diffstat (limited to 'cmd/server/main.go')
-rw-r--r-- | cmd/server/main.go | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/cmd/server/main.go b/cmd/server/main.go index 8b1cc00..54a7ba0 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -109,17 +109,27 @@ func main() { v.SetMyselfIn(extRouter) } + // processors + var ( + fileScanner = worker.NewFileScanner(*root, mediaRepository) + exifScanner = worker.NewEXIFScanner(mediaRepository) + ) + // worker var ( serverWorker = worker.NewServerWorker(&fasthttp.Server{Handler: r.Handler}) - fileScanner = worker.NewFileScanner(*root, mediaRepository) - exifScanner = worker.NewEXIFScanner(mediaRepository) + fileWorker = worker.NewWorkerFromChanProcessor[string](fileScanner, scheduler) + exifWorker = worker.NewWorkerFromListProcessor[*media.Media]( + exifScanner, + scheduler, + logrus.WithField("context", "exif scanner"), + ) ) pool := worker.NewWorkerPool() pool.AddWorker("http server", serverWorker) - pool.AddWorker("exif scanner", worker.NewWorkerFromListProcessor[*media.Media](exifScanner, scheduler)) - pool.AddWorker("file scanner", worker.NewWorkerFromChanProcessor[string](fileScanner, scheduler)) + pool.AddWorker("exif scanner", exifWorker) + pool.AddWorker("file scanner", fileWorker) ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt) defer stop() |