Skip to content

Commit

Permalink
fix: library scanning cron job created on every instance instead of j…
Browse files Browse the repository at this point in the history
…ust one
  • Loading branch information
zackpollard committed Oct 25, 2024
1 parent c124cf9 commit fa2f85f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions server/src/services/library.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ export class LibraryService extends BaseService {

this.watchLibraries = this.watchLock && watch.enabled;

this.jobRepository.addCronJob(
'libraryScan',
scan.cronExpression,
() => handlePromiseError(this.jobRepository.queue({ name: JobName.LIBRARY_QUEUE_SYNC_ALL }), this.logger),
scan.enabled,
);
if (this.watchLock) {
this.jobRepository.addCronJob(
'libraryScan',
scan.cronExpression,
() => handlePromiseError(this.jobRepository.queue({ name: JobName.LIBRARY_QUEUE_SYNC_ALL }), this.logger),
scan.enabled,
);
}

if (this.watchLibraries) {
await this.watchAll();
Expand Down

0 comments on commit fa2f85f

Please sign in to comment.