When fetching analysis results in private mode, the plugin can permanently lose results if the save loop is interrupted.
The orchestrator /tickets endpoint has "consume-once" logics: as soon as it responds, the returned jobs are marked as delivered server-side and their content is cleared. The plugin then saves them in a non-atomic, non-acknowledged loop (p_ws_ai_check_tickets). If the PHP process dies after the first ticket (execution timeout, connection closed by the fire-and-forget caller, fatal during an embedding write...), the remaining tickets are lost forever: the server already considers them delivered and will never return them again.
Observed: 8 pending tickets, all completed and delivered server-side (callback status is ok), but only 1 saved into Piwigo.
Solutions:
- Delivery should be at-least-once with acknowledgement (only ack tickets actually persisted in DB).
- p_ai_save_ticket should be idempotent (a re-delivered completed ticket must not re-prefix the description nor re-add tags).
- A single locked code path for both automatic and forced checks; force should take over the token, not bypass it.
Related with this issue:
the force=true path in p_ws_ai_check_tickets only tests pwg_unique_exec_is_running() then proceeds without pwg_unique_exec_begins(), so a manual check can run concurrently with the automatic fire-and-forget one, racing on
the destructive endpoint (error: "Automatic ticket verification is already in progress.").
When fetching analysis results in private mode, the plugin can permanently lose results if the save loop is interrupted.
The orchestrator
/ticketsendpoint has "consume-once" logics: as soon as it responds, the returned jobs are marked as delivered server-side and their content is cleared. The plugin then saves them in a non-atomic, non-acknowledged loop (p_ws_ai_check_tickets). If the PHP process dies after the first ticket (execution timeout, connection closed by the fire-and-forget caller, fatal during an embedding write...), the remaining tickets are lost forever: the server already considers them delivered and will never return them again.Observed: 8 pending tickets, all completed and delivered server-side (callback status is ok), but only 1 saved into Piwigo.
Solutions:
Related with this issue:
the
force=truepath inp_ws_ai_check_ticketsonly testspwg_unique_exec_is_running()then proceeds withoutpwg_unique_exec_begins(), so a manual check can run concurrently with the automatic fire-and-forget one, racing onthe destructive endpoint (error: "Automatic ticket verification is already in progress.").