tasker

A high precision scheduler including timezone aware cron jobs
1.0.0 released

Tasker

A scheduler for crystal lang. Allows you to schedule tasks to run in the future.

Usage

Delay execution of a task

    Tasker.next_tick { perform_action }

Grab an instance of the scheduler

    require "tasker"

    # Grab the default scheduler - really only need a single instance per application
    schedule = Tasker.instance

At a time in the future

    schedule.at(20.seconds.from_now) { perform_action }

After some period of time

    schedule.in(20.seconds) { perform_action }

Repeating every time period

    task = schedule.every(20.seconds) { perform_action }
    sleep 40
    # Pausing stops the schedule from running
    task.pause
    sleep 40
    task.resume

Running a CRON job

    # Run a job at 7:30am every day
    schedule.cron("30 7 * * *") { perform_action }

    # Also supports pause and resume
tasker:
  github: spider-gazelle/tasker
  version: ~> 1.0.0
Crystal none

Dependencies 2

Development Dependencies 0

Last synced .
search fire star recently