mirror of
https://github.com/misenhower/splatoon3.ink.git
synced 2026-08-20 07:34:28 -05:00
Automatically archive new data
This commit is contained in:
@@ -2,14 +2,17 @@ import { CronJob } from "cron";
|
||||
import { updatePrimary, updateLowPriority } from "./data/index.mjs";
|
||||
import { warmCaches } from "./splatnet/index.mjs";
|
||||
import { sendStatuses } from "./social/index.mjs";
|
||||
import { archiveData } from "./data/DataArchiver.mjs";
|
||||
|
||||
export default function() {
|
||||
new CronJob('5,20,35,50 * * * *', warmCaches, null, true);
|
||||
new CronJob('15 0,2,5,10,15,30,45 * * * *', async () => {
|
||||
await updatePrimary();
|
||||
await sendStatuses();
|
||||
await archiveData();
|
||||
}, null, true);
|
||||
new CronJob('1 * * * *', async () => {
|
||||
await updateLowPriority();
|
||||
await archiveData();
|
||||
}, null, true);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,10 @@ import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3';
|
||||
import fs from 'fs/promises';
|
||||
import prefixedConsole from "../common/prefixedConsole.mjs";
|
||||
|
||||
export function archiveData() {
|
||||
return (new DataArchiver).process();
|
||||
}
|
||||
|
||||
export default class DataArchiver
|
||||
{
|
||||
inputDirectory = 'storage/archive';
|
||||
|
||||
@@ -7,7 +7,7 @@ import { warmCaches } from "./splatnet/index.mjs";
|
||||
import MastodonClient from './social/clients/MastodonClient.mjs';
|
||||
import ImageWriter from './social/clients/ImageWriter.mjs';
|
||||
import BlueskyClient from './social/clients/BlueskyClient.mjs';
|
||||
import DataArchiver from './data/DataArchiver.mjs';
|
||||
import { archiveData } from './data/DataArchiver.mjs';
|
||||
|
||||
consoleStamp(console);
|
||||
dotenv.config();
|
||||
@@ -22,7 +22,7 @@ const actions = {
|
||||
splatnet: updatePrimary,
|
||||
splatnetAll: updateAll,
|
||||
warmCaches,
|
||||
dataArchive: () => (new DataArchiver).process(),
|
||||
dataArchive: archiveData,
|
||||
}
|
||||
|
||||
const command = process.argv[2];
|
||||
|
||||
Reference in New Issue
Block a user