Skip to content

Commit

Permalink
gadgets-sync: trigger immediately on config page edits
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthvp committed Sep 6, 2024
1 parent 9d66b0f commit 998a1b7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
4 changes: 3 additions & 1 deletion eventstream-router/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -20,6 +21,7 @@ const routeClasses = [
DbTabulatorMetadata,
ShutoffsMonitor,
Purger,
GadgetsSync,
];

// debugging a single route example: -r "./test"
Expand Down
23 changes: 23 additions & 0 deletions gadgets-sync/eventstream-trigger.ts
Original file line number Diff line number Diff line change
@@ -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');
}

}

0 comments on commit 998a1b7

Please sign in to comment.