From 707d244aaf228d51e6bbf4e1839117889f518f91 Mon Sep 17 00:00:00 2001 From: wea_ondara Date: Sat, 25 Nov 2023 17:02:06 +0100 Subject: [PATCH] refactor: renaming --- ...pdateCacheRenewJob.ts => MangaUpdatesCacheRenewJob.ts} | 8 ++++---- backend/src/schedule/Scheduler.ts | 4 ++-- ...heRenewService.ts => MangaUpdatesCacheRenewService.ts} | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) rename backend/src/schedule/{MangaUpdateCacheRenewJob.ts => MangaUpdatesCacheRenewJob.ts} (61%) rename backend/src/service/{MangaUpdateCacheRenewService.ts => MangaUpdatesCacheRenewService.ts} (87%) diff --git a/backend/src/schedule/MangaUpdateCacheRenewJob.ts b/backend/src/schedule/MangaUpdatesCacheRenewJob.ts similarity index 61% rename from backend/src/schedule/MangaUpdateCacheRenewJob.ts rename to backend/src/schedule/MangaUpdatesCacheRenewJob.ts index 37718b9..d82038e 100644 --- a/backend/src/schedule/MangaUpdateCacheRenewJob.ts +++ b/backend/src/schedule/MangaUpdatesCacheRenewJob.ts @@ -1,13 +1,13 @@ import IJob from './IJob'; -import MangaUpdateCacheRenewService from '../service/MangaUpdateCacheRenewService.js'; +import MangaUpdatesCacheRenewService from '../service/MangaUpdatesCacheRenewService'; import {MangaUpdatesCache} from '../cache/MangaUpdatesCache.js'; -export default class MangaUpdateCacheRenewJob implements IJob { - private readonly service: MangaUpdateCacheRenewService; +export default class MangaUpdatesCacheRenewJob implements IJob { + private readonly service: MangaUpdatesCacheRenewService; private lock: boolean = false; constructor(cache: MangaUpdatesCache) { - this.service = new MangaUpdateCacheRenewService(cache); + this.service = new MangaUpdatesCacheRenewService(cache); } get schedule(): Date | string { diff --git a/backend/src/schedule/Scheduler.ts b/backend/src/schedule/Scheduler.ts index c33920f..dc1b621 100644 --- a/backend/src/schedule/Scheduler.ts +++ b/backend/src/schedule/Scheduler.ts @@ -1,6 +1,6 @@ import {MangaUpdatesCache} from '../cache/MangaUpdatesCache.js'; import IJob from './IJob.js'; -import MangaUpdateCacheRenewJob from './MangaUpdateCacheRenewJob.js'; +import MangaUpdatesCacheRenewJob from './MangaUpdatesCacheRenewJob'; import {gracefulShutdown, scheduleJob} from 'node-schedule'; import {MangaDexCache} from '../cache/MangaDexCache'; import MangaDexCacheRenewJob from './MangaDexCacheRenewJob'; @@ -11,7 +11,7 @@ export default class Scheduler { constructor(mangaDexCache: MangaDexCache, mangaUpdatesCache: MangaUpdatesCache) { this.jobs.push( new MangaDexCacheRenewJob(mangaDexCache), - new MangaUpdateCacheRenewJob(mangaUpdatesCache), + new MangaUpdatesCacheRenewJob(mangaUpdatesCache), ); } diff --git a/backend/src/service/MangaUpdateCacheRenewService.ts b/backend/src/service/MangaUpdatesCacheRenewService.ts similarity index 87% rename from backend/src/service/MangaUpdateCacheRenewService.ts rename to backend/src/service/MangaUpdatesCacheRenewService.ts index 4848ac1..02224ef 100644 --- a/backend/src/service/MangaUpdateCacheRenewService.ts +++ b/backend/src/service/MangaUpdatesCacheRenewService.ts @@ -1,6 +1,6 @@ import {MangaUpdatesCache} from '../cache/MangaUpdatesCache'; -export default class MangaUpdateCacheRenewService { +export default class MangaUpdatesCacheRenewService { private static readonly delay = 3000; private readonly cache: MangaUpdatesCache; @@ -22,7 +22,7 @@ export default class MangaUpdateCacheRenewService { console.log(titles.length + ' out-of-date relations'); for (let title of titles) { - await new Promise((r) => setTimeout(r, MangaUpdateCacheRenewService.delay)); + await new Promise((r) => setTimeout(r, MangaUpdatesCacheRenewService.delay)); try { const fromApi = await fetch('https://api.mangaupdates.com/v1/series/search', { method: 'POST', @@ -49,7 +49,7 @@ export default class MangaUpdateCacheRenewService { console.log(ids.length + ' out-of-date series'); for (let id of ids) { - await new Promise((r) => setTimeout(r, MangaUpdateCacheRenewService.delay)); + await new Promise((r) => setTimeout(r, MangaUpdatesCacheRenewService.delay)); try { const fromApi = await fetch('https://api.mangaupdates.com/v1/series/' + id); if (fromApi.status !== 200) { @@ -69,7 +69,7 @@ export default class MangaUpdateCacheRenewService { console.log(ids.length + ' out-of-date series updates'); for (let id of ids) { - await new Promise((r) => setTimeout(r, MangaUpdateCacheRenewService.delay)); + await new Promise((r) => setTimeout(r, MangaUpdatesCacheRenewService.delay)); try { const fromApi = await fetch('https://api.mangaupdates.com/v1/series/' + id + '/groups'); if (fromApi.status !== 200) {