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:
Michael Mayer
2023-03-08 12:42:57 +01:00
parent c787945732
commit 0fbb4043c6
10 changed files with 102 additions and 56 deletions

View File

@@ -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) {