Utilizing the Scheduled Reports function of executing a task on a specific day at a specific time, (say Wednesday @ 6:45 AM) It executes a webhook that Dispatches jobs from a Customer table based on if they’re a recurring customer that have jobs the same day every week.
It is working as intended, however the webhook looks like it is running multiple times! (Usually 3-4 times) I’ve looked at the logs and on average it can take over 600 seconds to go through the whole Customer table, which is beyond the max limit of 300 second for the timeout (not sure if this is an issue). “Run asynchronously?” is OFF.
Is there a way that I can edit the ‘Retry Report on Timeout’ ?
Perhaps we could increase the timeout period manually or remove it completely?
The webhook does run it’s course all the way through and creates all the jobs, would it make sense that it only retries when one isn’t already running with the same name?
I’m not sure how I can mitigate this problem on my end after reading the article, it just confirmed what my problem was. Our customer list is only going to grow and increase the processing time.
Can you describe what you are doing in more detail?
I will also be discussing this issue with Praveen our CEO.
To this point we have treated Reports (scheduled Rules) as relatively short lived actions with fixed timeout periods and fixed retry schedules.
We may need to accommodate longer lived actions with user specified timeouts and retry schedules. I don’t want to raise expectations too much, but we will discuss the matter.
We are essential automatically creating a dispatch of jobs for a service company which have clients that receive certain services on a fixed schedule (Ex. One service a Week every Monday). We do this by leveraging the Reports periodic schedule which you can see in the Screenshots I sent.
The report goes through our ‘Customer’ table and checks for three main indicators to determine whether it should create a dispatched job on the ‘Jobs’ table. Say it was Monday.We would check for the: AND(Service Type = Weekly, Account Status = Active, and Service Day = Monday) The report runs at 6:45AM CST every day.
If all three of these are TRUE, the webhook will Add a New Row to the Jobs table (which acts as a dispatch for workers and used as a logbook at the same time).
So, the Scheduled Report will go through our 450-500 row Customer table checking for these 3 variables on each customer (row), then it will trigger the webhook which adds a new dispatch on the Jobs table for the assigned employee to complete.
The Report continues to Retry every 4 minutes until the original (1st try of the) Report completes it’s Cycle. So I’ll essential have a giant list of dispatches for that day and will need to manually go in and delete over 400 duplicates every day at the moment. Which almost defeats the purpose of having it automated in the first place.
_
On a side note, if these Report’s are supposed to be timing out, shouldn’t they stop running?
Why does it continue to run all the way through to end of our Customer list either way?
Does the Report wait for the webhook to complete before moving onto reading the next row? Perhaps there is a way to have it continue running through the report and just have the Webhooks run at the same time (asynchronously?)
Going to try the Run Asynchronously feature actually now that I think of it. Should AppSheet run this webhook asynchronously (in the background) and let the rule return immediately?
Yes, if you specify “Run Asynchronously” the webhook will be invoked, it will run asynchronously, and the call will return immediately. That may greatly help performance in your case.
I wonder if you could use the REST API to make the adds to the Jobs table even more efficient? The REST API allows you to add an entire set of rows in a single request. That is vastly more efficient than adding rows one at a time.
To add multiple rows at a time, you define a JSON template that contains a << Start >> expression than selects the rows you wish to add. All of the selected rows end up in the JSON body that is sent to the single REST API “Add” call.
You can include the row selection logic in the << Start >> expression within the JSON body. But, it is often easier to create a Slice that contains the row selection logic. This makes it easier to verify that the Slice is return the expected rows. You then use the Slice in the << Start >> expression within the JSON template.
You can use both techniques at the same time. You can use a single REST API “Add” that specifies “Run Asynchronously”.
Your new template looks right except I don’t see the closing >> tag after the Start expression.
(That might be because of how this website displays >> tags.)
You should see a huge performance improvement if you are adding many rows.