Skip to content

Instantly share code, notes, and snippets.

@carimura
Created July 17, 2012 01:53
Show Gist options
  • Save carimura/3126464 to your computer and use it in GitHub Desktop.
Save carimura/3126464 to your computer and use it in GitHub Desktop.
# Scheduling a task to be queued at a specific time (eg. 1 hour from now)
schedule = client.schedules.create('MyWorker', payload,
{:start_at => Time.now + 3600})
# Running a task repeatedly (eg. every hour)
schedule = client.schedules.create('MyWorker', payload,
{:run_every => 3600})
# Scheduling a task to run until a certain time (eg. run 3 hours then stop)
schedule = client.schedules.create('MyWorker', payload,
{:end_at => Time.now + 3600 * 3})
# Altogether now (eg start in 1 hour, run every minute, end after 100 runs
schedule = client.schedules.create('MyWorker', payload,
{:start_at => Time.now + 3600,
:run_every => 60, :run_times => 100})
# And of course we support all languages
# PHP
$iw->postScheduleAdvanced('MyPHPWorker', array(), time()*60, 120, null, 10);
# Python
worker.postSchedule(name='MyPythonWorker', run_every=3600, run_times=5)
# Node.js
client.schedulesCreate('MyNodeWorker', {}, {}, (error, body) -> console.log(body))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment