Convert to BatchBuilder & QueueWorker
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3387691. --> Reported by: [amourow](https://www.drupal.org/user/281473) Related to !5 !2 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>Batch is manually created but does not facilitate cron</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>N/A</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <ol> <li>Switch to batch builder and use the MR from the original issue to build QueueWorker</li> <li>Ensure batch chunks run are specific to job items to solve <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/ai_tmgmt/-/work_items/3486286" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/ai_tmgmt/-/work_items/3486286</a></span></li> </ol> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <p>MR</p> <h3 id="summary-ui-changes">User interface changes</h3> <p>N/A</p> <h3 id="summary-api-changes">API changes</h3> <p>N/A</p> <h3 id="summary-data-model-changes">Data model changes</h3> <p>N/A</p> <h2>Original issue</h2> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p><del>With the batch processor, I found the batch always runs twice.</del> (unrelated, see <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-8"><a href="https://www.drupal.org/project/tmgmt/issues/3198609" title="Status: Needs review">#3198609: Same Job processed/checkout twice by the JobCheckoutManager</a></span>).</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p><strong>Via UI</strong></p> <ol> <li>Create new translation job and run the translation with AI translator.</li> </ol> <p>OR</p> <p><strong>Via continuous job</strong></p> <ol> <li>Create a continuous job</li> <li>Create a content item that matches it</li> <li>Wait until TMGMT cron runs</li> <li>Wait until TMGMT lock expires</li> <li>Wait until AI TMGMT queue worker cron runs</li> </ol> <p>All the above can be sped up e.g. using Simple Cron, enabling control of queue workers via cron interface, and setting frequency to higher, e.g. every minute (its very little effort, okay for them to run often). </p> <h3>Solution</h3> <p>The solution is in <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-8"><a href="https://www.drupal.org/project/tmgmt/issues/3198609" title="Status: Needs review">#3198609: Same Job processed/checkout twice by the JobCheckoutManager</a></span> and isn't related to this module.</p>
issue