-
We have a queue we will use to POST batches of data to a service endpoint. Due to volume and constraints on the receiving server, we cannot use a standard queue worker, but rather need to manually process queue jobs. Something like the pattern found here, except in a loop: https://github.com/OptimalBits/bull/blob/develop/PATTERNS.md#manually-fetching-jobs. Each job in the queue can contain multiple items, in varying numbers, that get accumulated into a batch. When the batch reaches a certain amount, we POST it, then start accumulating job items into a new batch. For example, say we POST in batches of 100 items: Job 1: 24 items Ideally, if a batch failed to POST for any reason, the associated queue jobs would get failed so that we can retry them. But, since we have to use Is there a better pattern I can use to do this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You can pass "true" as last argument of "moveToComplete" if you do not need to fetch the next job. Is that enough to solve your use case? |
Beta Was this translation helpful? Give feedback.
You can pass "true" as last argument of "moveToComplete" if you do not need to fetch the next job. Is that enough to solve your use case?