In an app I have a button that triggers a workflow that takes up to 5 minutes to schedule visits in Jobber. This is a long time for any user to wait without any feedback.
Is there a way to update that user on the state, stage of the workflow?
I do have a loop that runs through batches of 20 visits. Ideally, I would like to update even a text field textStatus.value
.
You could use a database table like a log stream?
Here's my idea:
- Create a database table like
app__log_stream
- Have the long running workflow write rows to the table with status updates
- In the main app, have a query that runs every
X
seconds
- Have it retrieve and delete the rows to "consume" the message
- The SQL query box can do multiple statements in one "query"
SELECT ... ;
DELETE ... ;
I think with this model, you can have the long running process write to the table while the main app consumes the messages with the consumer query running on an interval.
Edit: Actually, I just had the thought, you could also add a "batch_id" to each run's messages. Then you would have full records of the batch runs instead of an ephemeral stream.
3 Likes
Good idea @khill-fbmc. I have batch ids already and was thinking of something similar. I like your idea of select then delete. Let me play around with it and get back to you.
1 Like