User workerpool for scanning and hashing
All checks were successful
/ release (push) Successful in 31s
All checks were successful
/ release (push) Successful in 31s
This commit is contained in:
parent
f12462250a
commit
aeb47c2593
3 changed files with 160 additions and 64 deletions
|
@ -17,6 +17,7 @@ import (
|
|||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
|
||||
"git.lastassault.de/speatzle/morffix/config"
|
||||
"git.lastassault.de/speatzle/morffix/workerpool"
|
||||
)
|
||||
|
||||
var conf config.Config
|
||||
|
@ -129,8 +130,11 @@ func Start(_conf config.Config, tmplFS embed.FS, staticFS embed.FS, migrationsFS
|
|||
stopWorkerManagement := make(chan bool, 1)
|
||||
go manageWorkers(stopWorkerManagement)
|
||||
|
||||
scanPool := workerpool.NewWorkerPool(10, 100000)
|
||||
hashPool := workerpool.NewWorkerPool(5, 100000)
|
||||
|
||||
stopScanning := make(chan bool, 1)
|
||||
go manageScan(stopScanning)
|
||||
go manageScan(stopScanning, scanPool, hashPool)
|
||||
|
||||
sigs := make(chan os.Signal, 1)
|
||||
signal.Notify(sigs, os.Interrupt)
|
||||
|
@ -146,6 +150,10 @@ func Start(_conf config.Config, tmplFS embed.FS, staticFS embed.FS, migrationsFS
|
|||
stopWorkerManagement <- true
|
||||
slog.Info("Stopping Scanning...")
|
||||
stopScanning <- true
|
||||
slog.Info("Stopping Scanning Pool...")
|
||||
scanPool.Stop()
|
||||
slog.Info("Stopping Hashing Pool...")
|
||||
hashPool.Stop()
|
||||
slog.Info("Done")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue