Files
photoprism/internal/mutex/activities.go
Michael Mayer 0e7c91f1b6 Config: Allow scheduling of indexing and backup tasks #2495 #2608 #4243
Note that this is "bleeding edge" functionality and that the newly added
config option PHOTOPRISM_BACKUP_RETAIN can be set, but does not have any
effect yet. Feedback welcome!

Signed-off-by: Michael Mayer <michael@photoprism.app>
2024-05-11 19:11:49 +02:00

28 lines
703 B
Go

package mutex
// Activities that can be started and stopped.
var (
IndexWorker = Activity{}
SyncWorker = Activity{}
BackupWorker = Activity{}
ShareWorker = Activity{}
MetaWorker = Activity{}
FacesWorker = Activity{}
UpdatePeople = Activity{}
)
// CancelAll requests to stop all activities.
func CancelAll() {
UpdatePeople.Cancel()
IndexWorker.Cancel()
SyncWorker.Cancel()
ShareWorker.Cancel()
MetaWorker.Cancel()
FacesWorker.Cancel()
}
// WorkersRunning checks if a worker is currently running.
func WorkersRunning() bool {
return IndexWorker.Running() || SyncWorker.Running() || BackupWorker.Running() || ShareWorker.Running() || MetaWorker.Running() || FacesWorker.Running()
}