I have to model following situation:
I have two queues named: syncaccounts and syncrecommendataion, syncaccounts can run independently of syncrecommendation, but syncrecommendataion can only start executing if syncaccounts queue is empty, i.e, syncaccounts queue is not processing job and don't have any jobs waiting to get processed
I tried using flow producers but it expect me to start syncrecommendataion queue processing in order to start syncaccounts and also it does not prevent syncrecommendataion to process if syncaccount is getting processed already
In short I want syncrecommendation queue to only start processing after syncaccounts queue is finished processing
const flowProducer = new FlowProducer();
const flowProducerName = "flowproducer";
const flow = await flowProducer.add({
name: flowProducerName,
queueName: syncRecommendationQueuName,
data: {baz: "bar"},
children: [
{ name: 'syncresources', data: { account: 'ac1' }, queueName: syncAccountsQueueName },
{ name: 'syncresources', data: { account: 'ac2 }, queueName: syncAccountsQueueName },
{ name: 'syncresources', data: { account: 'ac3 }, queueName: syncAccountsQueueName },
]
})
await syncRecommendationQueue.add("syncrecommendationjob", {foo: "bar"});
This code does not prevent the processing syncrecommendation second time till the syncaccounts is processing
I want all the syncresources jobs to finish before any syncrecommendataion job starts processing