Paul Krill
Editor at Large

Deno adds Deno Cron for job scheduling

news
Nov 30, 20232 mins

Deno Cron jobs can perform actions such as updating state in Deno KV, pinging a website, sending email, initiating a database backup, and calling an API at regular intervals.

retro phone next to retro alarm clock
Credit: Thinkstock

Deno Land, the developers of the Deno TypeScript/JavaScript runtime, have introduced Deno Cron, a feature the company describes as an easy way to create scheduled jobs.

Announced November 29 and available behind the --unstable flag in Deno 1.38, Deno.cron() is a function that takes three parameters: the name of the scheduled job, the schedule, and the handler, the latter being the function executed on the schedule provided. Deno Cron’s schedule uses the Unix cron format and the UTC time zone. Deno Cron handlers can perform actions such as updating state in Deno KV, pinging a website, sending email, initiating a database backup, and calling an API at regular intervals.

Unlike cron jobs on Unix and Linux, Deno Cron executions do not overlap. Hence, if  an operator schedules a job to run every 10 minutes but the task takes 30 minutes, Deno Cron automatically skips the next scheduled run until the task is finished. Overlapping cron jobs can lead to unintended issues and require extra logic to avoid, Deno Land said; Deno Deno Cron sidesteps that. Deno Land also is working to support a JavaScript-friendly API to specify the cron schedule.

In explaining the rationale behind Deno Cron, Deno Land said building for the web has become increasingly complex. Modern software uses cloud infrastructure, dissects boilerplate code, and manages intricate configurations. But developers just want to focus on business logic. Deno Land strives to ease web development by removing config and unnecessary boilerplate. Like Deno KV and Deno Queues, which can be added to an application with only a few lines of code, Deno Cron is designed to make web development simpler, the company said.

On the Deno Deploy serverless JavaScript platform, Deno.cron() is automatically managed, allowing users to run cron jobs without a web server or even consistent requests to keep an isolate alive. Whenever a project is deployed, Deno Deploy automatically detects cron jobs and evaluates them. When it is time for a handler to run, Deno Deploy automatically spins an isolate on-demand to run it. A Cron tab has been added to the Deno Deploy dashboard to show active cron jobs in a project.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author