From the review of #792.
Deciding a kind word from the review page now writes the binding and its entity projection in one transaction, which is right: it is what stops an older agent run from applying its class after a person has decided. The transaction holds the type_bindings row from decide to commit, and inside it updates every entity in the base whose normalized specific_type matches that word. For a common word that is most of the base.
decide_alignment_kind_word is a synchronous HTTP handler, and the main pool sets no lock_timeout or statement_timeout — only query_engine/postgres.rs sets one, and that is for external databases. So a person's click can wait behind the aligner's entity update with no bound, and the only thing they see is a request that does not come back.
What it should do instead: set a lock_timeout on that handler's transaction and answer 409 when it expires, with a message saying the aligner is working on that word and to try again. A person who is told to wait a moment is in a different situation from a person watching a spinner.
Worth checking at the same time whether any other synchronous handler takes a lock that a background job can hold.
From the review of #792.
Deciding a kind word from the review page now writes the binding and its entity projection in one transaction, which is right: it is what stops an older agent run from applying its class after a person has decided. The transaction holds the
type_bindingsrow fromdecideto commit, and inside it updates every entity in the base whose normalizedspecific_typematches that word. For a common word that is most of the base.decide_alignment_kind_wordis a synchronous HTTP handler, and the main pool sets nolock_timeoutorstatement_timeout— onlyquery_engine/postgres.rssets one, and that is for external databases. So a person's click can wait behind the aligner's entity update with no bound, and the only thing they see is a request that does not come back.What it should do instead: set a
lock_timeouton that handler's transaction and answer 409 when it expires, with a message saying the aligner is working on that word and to try again. A person who is told to wait a moment is in a different situation from a person watching a spinner.Worth checking at the same time whether any other synchronous handler takes a lock that a background job can hold.