docs(ocr): document tail-recursive queue drain design in promoteNextQueuedRun
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -173,6 +173,11 @@ public class SenderModelService {
|
||||
* Promotes the oldest QUEUED sender run to RUNNING and triggers its training.
|
||||
* Called in the finally block of triggerSenderTraining, creating a sequential chain:
|
||||
* each run promotes the next only after it fully completes (success or failure).
|
||||
*
|
||||
* This is intentionally tail-recursive via the @Async thread: the same thread holds the
|
||||
* full queue drain, serialising all sender training runs naturally without an external
|
||||
* scheduler. With N queued runs the thread stays occupied for N sequential trainings —
|
||||
* acceptable because the @Async executor is dedicated to long-running background work.
|
||||
*/
|
||||
private void promoteNextQueuedRun() {
|
||||
Optional<OcrTrainingRun> queuedOpt = txTemplate.execute(status ->
|
||||
|
||||
Reference in New Issue
Block a user