Currently, there is no option to instantiate the chain without any QueueableJob, what mean we need to first add the first one, and later use the chain() method.
In some use-cases, where we are not sure if we will spawn 0/1/2/... jobs, we need workarounds to check it. But it should allow us to do something like:
QueuableBuilder builder = Async.queueable();
if ( __something__ ) {
builder.chain(new Job1());
}
if ( __something__ ) {
builder.chain(new Job2());
}
if ( __something__ ) {
builder.chain(new Job3());
}
builder.enqueue(); // should either enqueue the chain or do nothing if none added.
Currently, there is no option to instantiate the chain without any QueueableJob, what mean we need to first add the first one, and later use the chain() method.
In some use-cases, where we are not sure if we will spawn 0/1/2/... jobs, we need workarounds to check it. But it should allow us to do something like: