Error reporting in task queue

0
We have a huge microflow that deals with subject access requests in once click. It exports everything to excel or pdf and zips them up.  Due to the microflow taking a while we've changed it to run in a task queue, admin triggers it and it runs in a task queue. At the end of the microflow it sets a status from Pending to Ready and emails the admin.  There are always unexpected errors in pdf and excel generators, but the admin has know way of knowing if their request errored. I am wondering what my options are to show it has errored.    1. Add error handling to all generation bits, there are a lot of them however, do this is not so practical.  2. Have some sort of timeout, that picks up any that have been in pending more the X minutes. 
asked
3 answers
2

Garion,

If you call this microflow from another microflow, you can add error processing on the sub-microflow.  I think this will catch any unexpected errors.

 

From a 'best practices' standpoint, if time allows, I would consider re-architecting the microflow so there is one generation action if possible (or fewer than there are currently) so you can capture the error where it happens and handle it from there.

 

Also, maybe consider using a logging entity since this microflow is running in a task queue.  Then you can capture any generated errors and review them after they occur.

 

Hope that helps,

Mike

answered
0

I would suggest you to break the microflow into meaningful parts and wrap them inside another microflow. While calling the submicroflows, set error handling to "Custom with Roll-back" (or Custom without Roll-back if you believe failing that particular microflow does not need DB roll-back).

 

In the error handling part, you can call an error reporting microflow by providing inputs $latestError and the your original input entity. The error reporting writes a log to console and as well as a persistable ErrorLog entity which you can show in the Admin panel.

answered
0

Add a status flag for Failed alongside Pending and Ready.

Put the PDF/Excel logic in a sub-microflow with custom error handling → if it errors, update the request to Failed and store/log the message.

This gives the admin immediate visibility without relying on timeouts.

answered