Skip to content

Latest commit

 

History

History
39 lines (28 loc) · 798 Bytes

README.md

File metadata and controls

39 lines (28 loc) · 798 Bytes

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.