Refactor workers

This commit is contained in:
Ben Sarmiento
2024-01-27 13:17:45 +01:00
parent e01622064d
commit 05d2544fe8
6 changed files with 127 additions and 171 deletions

View File

@@ -41,6 +41,13 @@ func (se *ScriptExecutor) Execute() (string, error) {
return out.String(), nil
}
func (t *TorrentManager) TriggerHookOnLibraryUpdate(updatedPaths []string) {
_ = t.workerPool.Submit(func() {
OnLibraryUpdateHook(updatedPaths, t.Config, t.log)
t.log.Debugf("Triggered hook on_library_update for %d path(s)", len(updatedPaths))
})
}
func OnLibraryUpdateHook(paths []string, config config.ConfigInterface, log *logutil.Logger) {
executor := &ScriptExecutor{
Script: config.GetOnLibraryUpdate(),