Compare commits

1 Commits

Author SHA1 Message Date
6fc6ae833b pre-main 2026-01-30 15:22:44 +03:00

View File

@@ -18,7 +18,7 @@ export class SyncService {
private readonly scraper: ScraperService, private readonly scraper: ScraperService,
) {} ) {}
@Cron(CronExpression.EVERY_DAY_AT_MIDNIGHT) @Cron(CronExpression.EVERY_HOUR)
async handleDailySync() { async handleDailySync() {
this.logger.log('Starting daily game synchronization job...'); this.logger.log('Starting daily game synchronization job...');
for (const url of this.TARGET_URLS) { for (const url of this.TARGET_URLS) {
@@ -36,7 +36,10 @@ export class SyncService {
await this.upsertGame(gameData); await this.upsertGame(gameData);
} }
} catch (error) { } catch (error) {
this.logger.error(`Failed to sync URL ${url}: ${error.message}`, error.stack); this.logger.error(
`Failed to sync URL ${url}: ${error.message}`,
error.stack,
);
} }
} }
@@ -63,7 +66,7 @@ export class SyncService {
releaseDateText: dateText, releaseDateText: dateText,
isTBD: isTBD, isTBD: isTBD,
sourceUrl: data.sourceUrl, sourceUrl: data.sourceUrl,
} },
}); });
// this.logger.debug(`Upserted game: ${data.title}`); // this.logger.debug(`Upserted game: ${data.title}`);
} catch (error) { } catch (error) {
@@ -78,7 +81,11 @@ export class SyncService {
.replace(/(^-|-$)+/g, ''); .replace(/(^-|-$)+/g, '');
} }
private parseDate(rawDate?: string): { releaseDate: Date | null, isTBD: boolean, dateText: string | null } { private parseDate(rawDate?: string): {
releaseDate: Date | null;
isTBD: boolean;
dateText: string | null;
} {
if (!rawDate) return { releaseDate: null, isTBD: true, dateText: 'TBD' }; if (!rawDate) return { releaseDate: null, isTBD: true, dateText: 'TBD' };
// Clean string // Clean string
@@ -105,7 +112,7 @@ export class SyncService {
return { return {
releaseDate: date, releaseDate: date,
isTBD: date === null, isTBD: date === null,
dateText: clean dateText: clean,
}; };
} }
} }