Codeunit 461 Job Queue Cleanup Tasks, source in 29

Source29

src/Layers/W1/BaseApp/Modules/System/JobQueue/JobQueueCleanupTasks.Codeunit.al27 lines, Copyright (c) Microsoft Corporation. MIT

namespace System.Threading;

codeunit 461 "Job Queue Cleanup Tasks"
{
    InherentEntitlements = X;
    InherentPermissions = X;
    TableNo = "Job Queue Entry";

    var
        JobQueueManagement: Codeunit "Job Queue Management";

    trigger OnRun()
    begin
        if (Rec."Object Type to Run" = Rec."Object Type to Run"::Codeunit) and (Rec."Object ID to Run" = Codeunit::"Job Queue Cleanup Tasks") then
            CleanupJQTasks()
        else
            JobQueueManagement.UpdateRetriableFailedJobQueueLogEntry(Rec);
    end;

    local procedure CleanupJQTasks()
    begin
        JobQueueManagement.CheckAndRefreshCategoryRecoveryTasks();
        JobQueueManagement.FindStaleJobsAndSetError();
    end;


}