diff --git a/eventstream-router/main.ts b/eventstream-router/main.ts index e7aead2..7d0541f 100644 --- a/eventstream-router/main.ts +++ b/eventstream-router/main.ts @@ -11,7 +11,8 @@ import BotActivityMonitor from "../bot-monitor/eventstream-trigger"; import DbTabulatorMetadata from "../db-tabulator/eventstream-metadata-maintainer"; import ShutoffsMonitor from "./routes/shutoffs-monitor"; import DykCounts from "../dyk-counts/eventstream-trigger"; -import Purger from "./routes/purger" +import Purger from "./routes/purger"; +import GadgetsSync from "../gadgets-sync/eventstream-trigger"; const routeClasses = [ Gans, @@ -20,6 +21,7 @@ const routeClasses = [ DbTabulatorMetadata, ShutoffsMonitor, Purger, + GadgetsSync, ]; // debugging a single route example: -r "./test" diff --git a/gadgets-sync/eventstream-trigger.ts b/gadgets-sync/eventstream-trigger.ts new file mode 100644 index 0000000..6b34201 --- /dev/null +++ b/gadgets-sync/eventstream-trigger.ts @@ -0,0 +1,23 @@ +import {Route} from "../eventstream-router/app"; +import {RecentChangeStreamEvent} from "../eventstream-router/RecentChangeStreamEvent"; +import {invokeCronJob} from "../k8s"; + +export default class GadgetsSync extends Route { + name = 'gadgets-sync'; + + async init() { + super.init(); + this.log('[S] Started'); + } + + filter(data: RecentChangeStreamEvent): boolean { + return data.wiki === 'enwiki' && + data.type === 'edit' && + data.title === 'User:SDZeroBot/Gadgets-sync-config.json'; + } + + async worker(data: RecentChangeStreamEvent) { + invokeCronJob('gadgets-sync'); + } + +}