Simon Willison’s Weblog

Subscribe

3 items tagged “cron”

2023

Announcing Deno Cron. Scheduling tasks in deployed applications is surprisingly difficult. Deno clearly understand this, and they’ve added a new Deno.cron(name, cron_definition, callback) mechanism for running a JavaScript function every X minutes/hours/etc.

As with several other recent Deno features, there are two versions of the implementation. The first is an in-memory implementation in the Deno open source binary, while the second is a much more robust closed-source implementation that runs in Deno Deploy:

“When a new production deployment of your project is created, an ephemeral V8 isolate is used to evaluate your project’s top-level scope and to discover any Deno.cron definitions. A global cron scheduler is then updated with your project’s latest cron definitions, which includes updates to your existing crons, new crons, and deleted crons.”

Two interesting features: unlike regular cron the Deno version prevents cron tasks that take too long from ever overlapping each other, and a backoffSchedule: [1000, 5000, 10000] option can be used to schedule attempts to re-run functions if they raise an exception. # 29th November 2023, 5:49 pm

2009

App Engine: Scheduled Tasks With Cron. Cron tasks simply hit a URL on your application, and can be run as frequently as once a minute. They made up their own syntax, which much nicer than traditional unix cron. # 8th April 2009, 2:04 pm

2008

The Cron Commandments. How to write well-behaved cron scripts, from Dean Wilson. # 27th June 2008, 9:48 am