Job Queue Error

beyrembeyrem Member Posts: 10
Hello,

I have an issue with the Job queues.
In fact in case of error (exple : parameter missing or non authorized validation dates ) the status of the Job still "In Process" after job is finished, and is not reset to "Ready".
Also in case of error, even if the missing parameters are corrected the job still give the same last Error, i have to run manually the job for once, then next time it runs correctly with the NAS.

Does any one noticed this problem? Thanks for your help.

Best Regards.

Comments

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    This is standard behaviour. If the codeunit or report cannot execute completely, then the task status will show "In Progress" and won't be changed automatically. You could add code in codeunit 1 (function NASHandler) to set all "In Progress" tasks to "Ready", when the NAS is restarted.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • beyrembeyrem Member Posts: 10
    Thank you Luc,

    I have an additionnal question about this issue :
    When I see the codeunit 448 (function 'Handlerequest' (standard)):

    WasSuccess := CODEUNIT.RUN(CODEUNIT::"Job Queue Start Codeunit",JobQueueEntry);
    IF WasSuccess THEN BEGIN
    IF JobQueueEntry."Recurring Job" THEN BEGIN
    JobQueueEntry."No. of Attempts to Run" := 0;
    JobQueueEntry.Status := JobQueueEntry.Status::Ready;
    IF NOT JobQueueEntry.MODIFY THEN
    JobQueueEntry.INSERT;
    END;
    END ELSE BEGIN
    IF JobQueueEntry."Maximum No. of Attempts to Run" > JobQueueEntry."No. of Attempts to Run" THEN BEGIN
    JobQueueEntry."No. of Attempts to Run" := JobQueueEntry."No. of Attempts to Run" + 1;
    JobQueueEntry.Status := JobQueueEntry.Status::Ready;
    IF NOT JobQueueEntry.INSERT THEN
    JobQueueEntry.MODIFY;
    END;

    I understand that even if the status is not Success (Error) the job should also be at status "Ready".
    Is my understanding right ?
    Thank you for your help.
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    I have never used the "Maximum No. of Attempts to Run" and "No. of Attempts to Run" fields. If the codeunit cannot run due to a wrong number of parameters, I doubt if the return value is set to FALSE and that codeunit 448 continues the processing.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
Sign In or Register to comment.