Status: Accepted (in force). Reconstructed from implementation.
Two payroll preparations for the same company at once would corrupt the shared temp/live state. Runs are also large and long — a way is needed to (a) prevent concurrency and (b) let C# poll for completion.
A per-company control row, PayrollMonitor, acts as a lock:
spPrepareRegularPayroll / spSubmitRegularPayroll set IsBusy = 1 (with LastObjectId, Message, UpdatedDate) at the top and back to 0 at the end.-2 ("Payroll runner is currently busy").Good:
Message/UpdatedDate give C# and Ops a progress/liveness signal.Bad / costs:
IsBusy stays 1 forever → the classic incident (fix in runbook §1).⚠️ VERIFY whether a watchdog auto-resets stale monitors.