Each Report is stored as a record in a SQL database. The database record for each Report contains:
- The name of the application containing the Report.
- The name of the Report
- The date and time at which the Report should be triggered.
The Schedule Service is responsible for triggering the Report at the appropriate time. It does this by reading the Report records from the SQL database and looking for Reports that are due to be triggered.
When the Schedule Service finds a Report that is due to be triggered, it does an HTTP Post to the AppSheet service to invoke the Report. The Post request contains the application name and the Report name. This allows the AppSheet Service to find and perform the Report.
The Schedule Service then waits for a timeout period of up to four minutes for the Report to complete.
The AppSheet service is responsible to executing the Report. When it receives the Post from the Schedule Service it uses the application name and Report name contained in the HTTP Post to retrieve the Report and begin executing it.
The AppSheet service records the time the Report begins executing. Periodically, the AppSheet service checks to see if the Report is taking too long to execute. If the Report's total execution time exceeds four minutes, the AppSheet service aborts execution of the Report.
When the Report completes, the AppSheet service responds to the HTTP Post request and indicates whether the Report completed successfully.
While the AppSheet service is executing the Report, the Schedule Service is waiting for the AppSheet service to complete the Report and respond to the HTTP Post.
If the Report does not complete within four minutes, the Schedule Service assumes that the Report failed for some reason. A Report can fail for several reasons including:
- The Report may be complicated and take a long time to execute. As a result, the Report may exceed the AppSheet service's four minute timeout period.
- The Report may be delayed because it is competing with other Reports that are scheduled to run at the same time. Most people schedule their Reports to run exactly on the hour. This can cause a flood of Report to fire on exactly the hour and result in one Report waiting for other competing Reports. This can result in a timeout because the Report is not initiated immediately and does not complete within the Schedule Service's four minute timeout period. You can mitigate this by scheduling your Report to run at least a few minutes before or after the hour.
- The Report may be executing on an AppSheet server that is restarted for some reason. This can also cause a timeout.
When the Schedule Service detects that the Report has not completed within the four minute time out period, it will retry the Report up to three additional time. If the Audit History indicates that the Report is being invoked at four minute intervals, it is likely that the Schedule Service is performing Report retry.