DoMinutelyTasks Method
- Last UpdatedMar 17, 2026
- 2 minute read
The DoMinutelyTasks() method performs system maintenance that is required every minute.
Parameters
- sessionId
- Required. Holds the session ID and thus the user who is making this method call.
This method is called by the background service every minute. It performs the following checks:
- Purges all sessions that have not had their heartbeats refreshed for 10 minutes. If a value in the db_status.service_last_ran column was not updated or is older than 10 minutes from the current date and time, then this method opens a counter by updating the wait time to 10 minutes in the db_status.wait_time column, thus enabling the clients to reconnect to the database using their existing sessions that was broken due to temporary network problems, periodical system maintenance, etc. Then this counter is reduced by 1 every minute when this method is called. When it becomes 0 (after 10 minutes of wait time), the wait time counter is reset to null and the sessions that are older than 10 minutes are removed from the database. However if the db_status.service_last_ran column was updated within the last 10 minutes, then any sessions that are older than 10 minutes are removed immediately.
- Updates the estimated finish time field for each running job based on the quantity produced so far and the estimated production rate.
Number of batches to complete = (qty_reqd – qty_prod) / batch_size rounded up to next integer.
Time to Complete = Number of batches to complete * ext_prod_rate.
Sched_Finish_Time = Now + Time to Complete
- Triggers periodic data collection for a job or job steps, if they were configured to collect data on certain time intervals. If the data collection is due, and the corresponding job/job step is currently running on an entity, then the current value stored in the data_log_value is used to collect sample data in the Data_Log_n table. It finally updates the last_trigger_at column in the Data_Entry_Sched table with the current date and time to indicate the date and time the data collection trigger was triggered.
- Stops any steps that are currently and have an elapsed time (job_step_data.act_start_time + job_step.std_time) that is older than the current date and time. All users who are logged onto these steps will be logged off of the steps.
- Performs supply chain connector imports and exports.
- Checks for current utilization reasons that are elapsed. If the current reason has a non-null maximum duration, a non-null new reason code configured, and the duration of the current utilization event related to the reason has passed its configured maximum duration, then the current reason is changed to the configured new reason.