Skip to content

openworkers/openworkers-scheduler

Repository files navigation

openworkers-scheduler

To install dependencies:

bun install

To run:

bun run main.ts

Setup

If not already done, add the following trigger to the database:

CREATE OR REPLACE FUNCTION cron_update()
  RETURNS TRIGGER AS $$
DECLARE
BEGIN
  PERFORM pg_notify('cron_update', TG_OP);
  RETURN NEW;
END;
$$ LANGUAGE plpgsql;

CREATE TRIGGER "cron_update"
  AFTER INSERT OR DELETE OR UPDATE OF value, deleted_at ON crons
  EXECUTE PROCEDURE cron_update();

This will notify the cron_update channel whenever a row is inserted, updated or deleted in the crons table and allow the scheduler to update its internal state.


This project was created using bun init in bun v1.1.43. Bun is a fast all-in-one JavaScript runtime.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages