Skip to content

[tickets] results lost when save loop is interrupted #1

@LintyDev

Description

@LintyDev

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.").

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions