Hi all,
I was reading an article on the Trigger.dev website about writing durable tasks and have a question about a specific section. This is the one I'm talking about: https://trigger.dev/blog/v3-announcement#writing-regular-async-code-with-no-timeouts-and-durability
It shows a code snippet that uses a rollback function to revert a certain action if any errors happen after the rollback function is used. I can't seem to find this function anywhere. I happen to have a use case for it, because I am calling an API of a third party service in my task, but if any errors happen after that API call, I have to revert the changes (or do I?).
I remember that in V2, you could use the io.runTask function to "pick up where you left off" if anything goes wrong, so that certain functions are only executed once, even if the job fails. I am wondering how this works in V3. I somewhat understand the article mentioned above, but I am still a bit struggling to understand how this works exactly in V3. Should I implement this rollback function (as mentioned in the article)? If so, where do I find this rollback function? If not, will the task automatically skip the functions that were successfully executed and start at the failing functions?
Hopefully someone can help me understand this!