bcquality/microsoft/knowledge/performance/job-queue-on-hold-does-not-stop-running-work.good.al
2026-09-08 17:13:18 +02:00

49 lines
No EOL
971 B
AL

table 50114 "Job Cancellation Control"
{
DataClassification = SystemMetadata;
fields
{
field(1; "Job Queue Entry ID"; Guid)
{
}
field(2; "Stop Requested"; Boolean)
{
}
}
keys
{
key(PK; "Job Queue Entry ID")
{
Clustered = true;
}
}
}
codeunit 50114 "Job Queue On Hold Good"
{
TableNo = "Job Queue Entry";
trigger OnRun()
begin
while not IsStopRequested(Rec.ID) do
if not ProcessNextBatch() then
exit;
end;
local procedure IsStopRequested(JobQueueEntryId: Guid): Boolean
var
JobCancellationControl: Record "Job Cancellation Control";
begin
if not JobCancellationControl.Get(JobQueueEntryId) then
exit(false);
exit(JobCancellationControl."Stop Requested");
end;
local procedure ProcessNextBatch(): Boolean
begin
exit(false);
end;
}