Clarify Node runner names

This commit is contained in:
Matt Isenhower
2026-09-07 17:12:28 -07:00
parent 74cd311151
commit 09caa34d7d
4 changed files with 17 additions and 17 deletions

View File

@@ -1,14 +1,14 @@
import '../common/bootstrap.js';
import { CronJob } from 'cron';
import { updateAllLocally, postLocally } from './local.js';
import { updateAll, sendStatuses } from './node.js';
console.info('Starting periodic tasks...');
// Run every hour at 10sec after the hour
new CronJob('10 0 * * * *', async () => {
try {
await updateAllLocally();
await postLocally();
await updateAll();
await sendStatuses();
} catch (error) {
console.error(error);
}

View File

@@ -1,9 +1,9 @@
import '../common/bootstrap.js';
import { runAction } from '../common/cli.js';
import { updateAllLocally, postLocally, testScreenshotsLocally } from './local.js';
import { updateAll, sendStatuses, testScreenshots } from './node.js';
await runAction({
splatnet: updateAllLocally,
social: postLocally,
socialTest: testScreenshotsLocally,
splatnet: updateAll,
social: sendStatuses,
socialTest: testScreenshots,
}, process.argv.slice(2));

View File

@@ -1,9 +1,9 @@
// The local (Node) flavour of running the updaters: filesystem storage in the directories
// Node entry points use filesystem storage in the directories
// the site has always been built from. The Worker entry point has its own equivalent over R2.
import FilesystemStorage from '../common/storage/FilesystemStorage.js';
import { updateAll } from './updater/index.js';
import { sendStatuses, testScreenshots } from './social/index.js';
import * as updater from './updater/index.js';
import * as social from './social/index.js';
export function filesystemStorage() {
return {
@@ -12,20 +12,20 @@ export function filesystemStorage() {
};
}
export async function updateAllLocally() {
let updaters = await updateAll(filesystemStorage());
export async function updateAll() {
let updaters = await updater.updateAll(filesystemStorage());
if (updaters.some(updater => !updater.ok))
throw new Error('One or more updaters failed; social posting skipped.');
return 'Done';
}
export async function postLocally() {
let result = await sendStatuses(filesystemStorage());
export async function sendStatuses() {
let result = await social.sendStatuses(filesystemStorage());
if (!result.ok)
throw new Error('One or more social posts failed.');
return result;
}
export function testScreenshotsLocally() {
return testScreenshots(filesystemStorage());
export function testScreenshots() {
return social.testScreenshots(filesystemStorage());
}

View File

@@ -1,5 +1,5 @@
// Runs the shared updaters (src/app/updater) against this Worker's R2 bindings.
// This is the Worker's counterpart of src/app/local.js.
// This is the Worker's counterpart of src/app/node.js.
import { BucketStorage } from '../../../src/common/storage/index.js';
import { updateAll } from '../../../src/app/updater/index.js';