API operations/invocation

It seems I'm hitting a 1000 ops per invocation limit in my scheduled worker while writing to the KV. But I still need to write more than 1000 k/v pairs and bulk writes are not supported according to the docs. What is the recommended way of dealing with this? If instead of writing to KV I'll send the data over the queue and batch into 100 messages, would every 100 messages considered a separate invocation?
2 Replies
kian
kian2y ago
would every 100 messages considered a separate invocation?
Yes All of the ways of getting more subrequests in a Worker would include another invocation
kika
kika2y ago
great, thanks! Hmm, if the worker has a 1) scheduled event handler 2) queue handler and 3) http handler - is that 3 invocations or 1? Because I have exactly this, the scheduled event generates data, sends the data down the queue, queue handler processes data in batches of 100 messages at once and writes to KV. HTTP then serves data out of KV. Everything works until 1000th data item when runtime logs "Exceeded CPU Limit" and no more writes happen. Seems that the limit of 1000 KV ops per invocation still holds. @kiannh ^^^ any advice?
Want results from more Discord servers?
Add your server