fix: ensure lock stays on

This commit is contained in:
Jonathan Jogenfors
2024-02-29 19:02:27 +01:00
parent eda6572c87
commit 3db28aaa92
4 changed files with 8 additions and 23 deletions
+3 -5
View File
@@ -74,11 +74,9 @@ export class LibraryService extends EventEmitter {
const { watch, scan } = config.library;
this.watchLibraries = false;
if (watch.enabled) {
this.databaseRepository.withTryLock(DatabaseLock.LibraryWatch, async () => {
// This ensures that library watching only occurs in one microservice
// TODO: we could make the lock be per-library instead of global
this.watchLibraries = true;
});
// This ensures that library watching only occurs in one microservice
// TODO: we could make the lock be per-library instead of global
this.watchLibraries = await this.databaseRepository.tryLock(DatabaseLock.LibraryWatch);
}
this.jobRepository.addCronJob(
'libraryScan',