Changes between Version 1 and Version 2 of Ticket #37369, comment 3


Ignore:
Timestamp:
Sep 26, 2026, 12:46:16 PM (3 weeks ago)
Author:
Simon Charette

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #37369, comment 3

    v1 v2  
    11Have we considered adding a new `transaction` API replacement that implements the current behaviour instead of taking it away entirely?
    22
    3 I understand the rationale for defaulting to having `on_commit` raise when called outside of a transaction (mainly due its name) but I believe there is nonetheless merit in having a public API that allows the conditional deferring of an operation in code paths that may or may not be called within a transaction. It feels like a common enough pattern not to warrant making an explicit `in_transaction` check this is needed?
     3I understand the rationale for defaulting to having `on_commit` raise when called outside of a transaction (mainly due its name) but I believe there is nonetheless merit in having a public API that allows the conditional deferral of an operation in code paths that may or may not be called within a transaction. It feels like a common enough pattern not to warrant making an explicit `in_transaction` check this is needed?
    44
    55If we introduced a `defer_if_in_transaction` (better name very welcome) public API as a replacement we wouldn't require a setting as the deprecation warning could simply point at using it instead of `on_commit` (when the latter is called outside of a transaction) before we finally change the default behaviour of `on_commit`.
Back to Top