Stalker.enqueue takes 3 options: job name string, arguments hash, options hash.
The options hash can take the key/value pair :ttr => timeout_in_seconds, which, as you probably can guess, sets the number of seconds Stalker will allow before it raises the JobTimeout Exception.
E.g. if you have some crazy calculation you expect to take an hour:
#job code
job 'crazy.calculation' do |args|
args['x'].to_i + args['y'].to_i + args['z'].to_i
end
#queuing code
Stalker.enqueue 'crazy.calculation', {:x => 1, :y => 2, :z => 3}, {:ttr => 3600}
The same code if your calcuation doesn't take arguments
#job code
job 'crazy.calculation' do |args|
1 + 2 + 3
end
#queuing code
Stalker.enqueue 'crazy.calculation', {}, {:ttr => 3600}
Don't confused by the interchangeability of symbols and strings in the enqueue args hash and the job args hash, in the options hash :ttr MUST BE A SYMBOL.