Popularity
7.5
Growing
Activity
5.0
-
54
4
6

Programming language: Crystal
License: MIT License
Tags: Scheduling    
Latest version: v2.0.2

tasker alternatives and similar shards

Based on the "Scheduling" category.
Alternatively, view tasker alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of tasker or a related project?

Add another 'Scheduling' Shard

README

Tasker

Build Status

A high precision scheduler for crystal lang. Allows you to schedule tasks to run in the future and obtain the results.

Usage

At a time in the future

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

    # If you would like the value of that result
    # returns value or raises error - a Future
    Tasker.at(20.seconds.from_now) { perform_action }.get

After some period of time

    Tasker.in(20.seconds) { perform_action }

Repeating every time period

    task = Tasker.every(2.milliseconds) { perform_action }
    # Canceling stops the schedule from running
    task.cancel
    # Resume can be used to restart a canceled schedule
    task.resume

You can grab the values of repeating schedules too

    tick = 0
    task = Tasker.every(2.milliseconds) { tick += 1; tick }

    # Calling get will pause until after the next schedule has run
    task.get == 1 # => true
    task.get == 2 # => true
    task.get == 3 # => true

    # It also works as an enumerable
    # NOTE:: this will only stop counting once the schedule is canceled
    task.each do |count|
      puts "The count is #{count}"
      task.cancel if count > 5
    end

Running a CRON job

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

    # For running in a job in a particular time zone:
    berlin = Time::Location.load("Europe/Berlin")
    Tasker.cron("30 7 * * *", berlin) { perform_action }

    # Also supports pause, resume and enumeration