Config: Allow disabling background workers in unsafe mode #1359 #1618

This commit is contained in:
Michael Mayer
2021-10-17 14:25:29 +02:00
parent 5adf2b2521
commit 85b0ee5b61
7 changed files with 40 additions and 20 deletions

View File

@@ -42,9 +42,17 @@ import (
var log = event.Log
var stop = make(chan bool, 1)
// Start runs PhotoPrism background workers every wakeup interval.
// Start runs the metadata, share & sync background workers at regular intervals.
func Start(conf *config.Config) {
ticker := time.NewTicker(conf.WakeupInterval())
interval := conf.WakeupInterval()
// Disabled in safe mode?
if interval.Seconds() <= 0 {
log.Warnf("config: disabled metadata, share & sync background workers")
return
}
ticker := time.NewTicker(interval)
go func() {
for {