refactor: renaming

This commit is contained in:
wea_ondara
2023-11-25 17:02:06 +01:00
parent 96150718e0
commit 707d244aaf
3 changed files with 10 additions and 10 deletions

View File

@@ -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<void> {
private readonly service: MangaUpdateCacheRenewService;
export default class MangaUpdatesCacheRenewJob implements IJob<void> {
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 {

View File

@@ -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),
);
}

View File

@@ -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) {