-
Notifications
You must be signed in to change notification settings - Fork 0
Submitting Jobs
##All the Options
instance_id
Call the method on a particular instance of the class. ConeyIsland will first call the :find method on the class and pass in the provided instance_id to get the instance. Then it will call the requested method on the instance.
ConeyIsland.submit(Post,:send_notifications, instance_id: 123)
singleton
This tells ConeyIsland that the class you provide is a singleton, and ConeyIsland should instantiate it first by calling MySingleton.new
ConeyIsland.submit(MySingleton, :do_something, singleton: true)
delay
Delay execution of the job on the worker. The delay value is a number of seconds.
ConeyIsland.submit(Tree, :prune_all, delay: 60)
retry_on_exception
Resubmit the job to the queue on exception. Each resubmission is delayed by a factor of 2 more than the last, starting with a 2-second delay. By default ConeyIsland will retry 3 times before bailing out. Please be careful with this, you can hurt yourself. Consider carefully what the outcome will be if your job has a bug in the code, and weeks from now you fix the bug. The job will run just as it would have weeks before. In most cases this would be a bad thing. Emails about timed events that have passed make the app look out-of-touch. Browser push for object state that has since changed will be just plain incorrect. Emailing a generated report that is out-of-date could lead to bad decisions. In our experience, only a small minority of jobs actually should retry on exception. The rest you'll see in your Airbrake/Honeybadger dashboard and be able to fix and resubmit.
ConeyIsland.submit(Account, :reconcile_all, retry_on_exception: true)
retry_limit
Stop retrying after n attempts. This option only takes effect if retry_on_execption
is set to true
. The default for jobs that are set to retry is 3 attempts. See the warning above for retryonexception and please be careful with this.
ConeyIsland.submit(Account, :reconcile_all, timeout: 600, retry_on_exception: true, retry_limit: 10)