Create a gist now

Instantly share code, notes, and snippets.

BEGIN;
SELECT ongoing FROM crontabber WHERE app_name = 'bar'
FOR UPDATE NOWAIT;
select pg_sleep(random() * 10);
UPDATE crontabber SET ongoing = now() WHERE app_name = 'bar';
COMMIT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment