Runs are resumable by returning Task stored data
Runs can exceed the maximum timeout on serverless platforms and can survive server restarts.
cacheKey
which is a string and is the first parameter. This should be stable and unique inside that run
function.Like we mentioned above, we use Task cache keys to determine which Tasks have already been executed. They are defined by you inside your run
function, for example when you call io.slack.postMessage
:
In this example, the cache key is the string "⭐️ New Star"
. This means that if the Job is interrupted and then resumed, the slack.postMessage
Task will be skipped because it has already been executed.
If you make multiple calls to slack.postMessage
, you should use different cache keys for each call. For example:
If you are calling a Task multiple times with the same key, it will only be executed once. For example, if you call slack.postMessage
with the key "⭐️ New Star"
twice, it will only be executed once.
See our Task concept guide for more information about tasks and how they are crucial to the resumability of your Jobs.
If you are using a loop, you should use the loop index as the key. For example:
We don’t currently support running tasks in parallel so Promise.all
will not work correctly.
This is something on our roadmap that we hope to support soon.