Skip to content

AI 0.25.1: A translation is no longer queued and paid for twice

AI 0.25.1 fixes double translations: a double click, or the same page open in two tabs, could queue one translation twice, so the model was called and billed twice and the second result overwrote the first.

Both requests checked whether a job was already running before either of them added one. Queueing a translation now holds a database lock for that resource, scope and target language while it checks and inserts. The second request waits, then reports that a translation is already in progress. Other resources and languages are not held up, and if anything fails under the lock the translation is still queued, without it.

Full release notes: AI 0.25.1

0.25.1 · 5 October 2026

Fixed

  • A translation could be queued twice by two simultaneous requests (a double click, or the same page open in two tabs) (PR #34). Both callers ran “is a job in flight?” before either inserted, so the model was called and billed twice and the second result overwrote the first. Translations.enqueue/1 now takes a transaction-level advisory lock on the (resource, scope, target language) identity around the check and the insert. The second caller waits, then answers conflict?: true. Other resources and languages do not wait. A caller already inside its own transaction takes no lock and opens no nested transaction. If anything fails under the lock, the check and insert run once more without it, so a translation is never silently skipped.

AI 0.25.1. Install or update: {:phoenix_kit_ai, "~> 0.25"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.