From 28733fac064ee2eef21b1080c73c394bdb81b182 Mon Sep 17 00:00:00 2001 From: Sing Date: Fri, 4 Aug 2023 19:21:55 +0800 Subject: [PATCH] Add logs to trace the crawlMovieSchdule --- src/crawler/movieSchduleCrawler.ts | 2 ++ src/task/atmoviesTask.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/crawler/movieSchduleCrawler.ts b/src/crawler/movieSchduleCrawler.ts index b717d73..acfb68c 100644 --- a/src/crawler/movieSchduleCrawler.ts +++ b/src/crawler/movieSchduleCrawler.ts @@ -23,7 +23,9 @@ export async function crawlMovieSchdule(scheduleUrl, date) { }); } catch (error) { + console.error('crawlMovieSchdule fail!'); console.error(error); } + console.log(`crawlMovieSchdule(${scheduleUrl}, ${date}), schedules.length: ${schedules.length}`) return schedules; } \ No newline at end of file diff --git a/src/task/atmoviesTask.ts b/src/task/atmoviesTask.ts index 238c190..9b597af 100644 --- a/src/task/atmoviesTask.ts +++ b/src/task/atmoviesTask.ts @@ -15,11 +15,13 @@ export async function updateMoviesSchedules() { .find({}, { projection: { scheduleUrl: 1, _id: 0 } }) .toArray(); const scheduleCrawlDate = await getScheduleCrawlDate(); + console.log('scheduleCrawlDate', scheduleCrawlDate); let schedulesPromise = scheduleUrls.map(({ scheduleUrl }) => crawlMovieSchdule(scheduleUrl, scheduleCrawlDate) ); const schedules = await Promise.all(schedulesPromise); const allSchedules: Schedule[] = [].concat(...schedules); + console.log('allSchedules.length', allSchedules.length); redisClient.setex(scheduleCrawlDate, 86400 * 2, JSON.stringify(allSchedules)); return allSchedules; }