Added logs for queues.
This commit is contained in:
@ -19,7 +19,13 @@ export class LibraryConsumer extends WorkerHost {
|
||||
}
|
||||
|
||||
async process(job: Job, token?: string): Promise<any> {
|
||||
console.log('job started:', job.name, job.data, job.id);
|
||||
this.logger.info({
|
||||
class: LibraryConsumer.name,
|
||||
method: this.process.name,
|
||||
job: job,
|
||||
msg: 'Started task on queue.',
|
||||
});
|
||||
|
||||
const series: CreateSeriesSubscriptionJobDto = job.data;
|
||||
|
||||
let context = this.provider.generateSearchContext(series.provider, series.title) as GoogleSearchContext;
|
||||
@ -52,9 +58,22 @@ export class LibraryConsumer extends WorkerHost {
|
||||
.filter((_, index, arr) => index == 0 || arr[index - 1].result.volume != arr[index].result.volume);
|
||||
job.updateProgress(25);
|
||||
|
||||
this.logger.debug({
|
||||
class: LibraryConsumer.name,
|
||||
method: this.process.name,
|
||||
job: job,
|
||||
msg: 'Finished searching for book entries.',
|
||||
results: {
|
||||
pages: pageSearchedCount,
|
||||
related_entries: related.length,
|
||||
volumes: books.length,
|
||||
}
|
||||
});
|
||||
|
||||
let counter = 0;
|
||||
for (let book of books) {
|
||||
try {
|
||||
// Force the provider's series id to be set, so that we know which series this belongs.
|
||||
book.result.providerSeriesId = series.providerSeriesId;
|
||||
await this.library.addBook(book.result);
|
||||
} catch (err) {
|
||||
@ -72,7 +91,12 @@ export class LibraryConsumer extends WorkerHost {
|
||||
}
|
||||
}
|
||||
|
||||
console.log('job completed:', job.name, job.data, job.id);
|
||||
this.logger.info({
|
||||
class: LibraryConsumer.name,
|
||||
method: this.process.name,
|
||||
job: job,
|
||||
msg: 'Completed task on queue.',
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user