mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
Faces: Run background worker only when data has been updated #3124
This may reduce server load and prevent disks from spinning up. We welcome tests reports! Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/photoprism/photoprism/internal/mutex"
|
||||
)
|
||||
|
||||
func TestPrism_Start(t *testing.T) {
|
||||
func TestMeta_Start(t *testing.T) {
|
||||
conf := config.TestConfig()
|
||||
|
||||
t.Logf("database-dsn: %s", conf.DatabaseDsn())
|
||||
@@ -27,15 +27,22 @@ func TestPrism_Start(t *testing.T) {
|
||||
delay := time.Second
|
||||
interval := time.Second
|
||||
|
||||
// Mutex should prevent worker from starting.
|
||||
if err := worker.Start(delay, interval, true); err == nil {
|
||||
t.Fatal("error expected")
|
||||
}
|
||||
|
||||
mutex.MetaWorker.Stop()
|
||||
|
||||
// Start worker.
|
||||
if err := worker.Start(delay, interval, true); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// Rerun worker.
|
||||
if err := worker.Start(delay, interval, false); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMeta_originalsPath(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user