Posts

Showing posts with the label enqueue

Use the System.enqueueJob Method to Specify a Delay in Scheduling Queueable Jobs

Image
  A new optional override adds queueable jobs to the asynchronous execution queue with a specified minimum delay (0–10 minutes). Using the  System.enqueue(queueable, delay)  method ignores any org-wide enqueue delay setting. The delay is ignored during Apex testing. Where:  This change applies to Lightning Experience and Salesforce Classic in Enterprise, Performance, Unlimited, and Developer editions. How:  Here are some cases where it can be beneficial to adjust the timing before the queueable job runs. If the external system is rate-limited and can be overloaded by chained queueable jobs that are making rapid callouts. When polling for results, and executing too fast can cause wasted usage of the daily async Apex limits. This example adds a job for delayed asynchronous execution by passing in an instance of your class implementation of the  Queueable  interface for execution. There’s a minimum delay of 5 minutes before the job is executed. Integer de...