Job Queue entry deleted

Hi,
i have job queue entry(“Restart Job queues”) which on executing restarts other set of job queue entries which are either “On hold” or “error” state. The issue facing with this is that few job queue entries are deleted after running the “restart job queues”. , unable to find a reason. debugged and checked not sure what is causing to delete entries.

and is there a way to debug a task created using task scheduler to run a specific codeunit?

would be great of someone can help

thanks

2 reasons for an entry to be deleted.

  1. Non-recurring job that has been run.

  2. Recurring job that has expired.

in my case job queue is recurring and job queue never expires.
i’ve grouped few job queues based on “Job queue category code” and created a codunit which loops through this set of job queues with same category code and restarts it.
i am calling the existing function jobqueueentrytable.restart , to restart the job queue