Skip to content

Releases: Envek/after_commit_everywhere

1.5.0: After exception don't execute other callbacks in a transaction

09 Dec 14:26
v1.5.0
81d9922
Compare
Choose a tag to compare

This behavior more closely matches ActiveRecord behavior for a single record

Added

  • Ability to propagate exception for multiple after_commit callbacks within transaction. Should handle exception inside callback to avoid stopping other callbacks.

    Pull request #35 by @kevink1103. Also see discussion at #34.

1.4.0: Prepending callbacks support

07 Feb 03:53
v1.4.0
2d72c71
Compare
Choose a tag to compare

Added

  • Ability to prepend callbacks to the head of callback queue using prepend: true option.

    AfterCommitEverywhere.after_commit { puts "I'm second!" }
    AfterCommitEverywhere.after_commit(prepend: true) { puts "I'm first!" }

    See Pull request #30 by [@quentindemetz][] and [@A1090][].

1.3.1: Don't package development-related files into released gem

21 Jun 06:22
v1.3.1
de799be
Compare
Choose a tag to compare

Fixed

  • Don't include development-related files into packaged gem to avoid confusing users or software tools. [@Envek][].

    See discussion at #26.

    Files packaged after this change:

    CHANGELOG.md
    LICENSE.txt
    README.md
    after_commit_everywhere.gemspec
    lib/after_commit_everywhere.rb
    lib/after_commit_everywhere/version.rb
    lib/after_commit_everywhere/wrap.rb
    

1.3.0: `in_transaction` helper method

28 Oct 04:21
v1.3.0
be89d3b
Compare
Choose a tag to compare

Added

  • in_transaction helper method to execute code within existing transaction or start a new one if there is no tx open.

    It is similar to ActiveRecord::Base.transaction, but it doesn't swallow ActiveRecord::Rollback exception in case when there is no transaction open.

    See discussion at #23 for details.

    Pull request #23 by [@jpcamara][].

  • Ability to call in_transaction helper with the same arguments as ActiveRecord::Base.transaction. [@Envek][].

1.2.2: Fix connection leak when for invocations outside of Rails executor (№2)

20 Jun 14:21
v1.2.2
a162325
Compare
Choose a tag to compare

Fixed

  • Connection leak from the connection pool when after_commit called outside Rails executor without connection checked out and some connections were already checked out from another threads.

    See discussion at issue #20 for details.

    Pull request #22 by [@Envek][].

1.2.1: Fix connection leak for invocations outside of Rails executor

10 Jun 16:12
v1.2.1
9056d71
Compare
Choose a tag to compare

Fixed

  • Connection leak from the connection pool when after_commit called outside Rails executor without connection checked out

    Usually all invocations of after_commit (whether it happens during serving HTTP request in Rails controller or performing job in Sidekiq worker process) are made inside Rails executor which checks in any connections back to the connection pool that were checked out inside its block.

    However, in cases when a) after_commit was called outside of Rails executor (3-rd party gems or non-Rails apps using ActiveRecord) and b) database connection hasn't been checked out yet, then connection will be checked out by after_commit implicitly by call to ActiveRecord::Base.connection and not checked in back afterwards causing it to leak from the connection pool.

    But in that case we can be sure that there is no transaction in progress ('cause one need to checkout connection and issue BEGIN to it), so we don't need to check it out at all and can fast-forward to without_tx action.

    See discussion at issue #20 for details.

    Pull request #21 by [@Envek][].

1.2.0: Allow to change callbacks action when called outside transaction

26 Mar 12:22
v1.2.0
71db9ac
Compare
Choose a tag to compare

Added

  • Allow to change callbacks' behavior when they are called outside transaction:

    AfterCommitEverywhere.after_commit(without_tx: :raise) do
      # Will be executed only if was called within transaction
      # Error will be raised otherwise
    end

    Available values for without_tx keyword argument:

    • :execute to execute callback immediately
    • :warn_and_execute to print warning and execute immediately
    • :raise to raise an exception instead of executing

    Pull request #18 by [@lolripgg][].

1.1.0: Allow to call transaction callbacks directly

05 Aug 19:48
v1.1.0
ebfbbc4
Compare
Choose a tag to compare

Added

  • Allow to call transactional callbacks directly on AfterCommitEverywhere module:

    AfterCommitEverywhere.after_commit { puts "If you see me then transaction has been successfully commited!" }
  • Allow to call in_transaction? helper method from instance methods in classes that includes AfterCommitEverywhere module.

1.0.0: Declare gem as stable

17 Feb 13:39
v1.0.0
9b1f565
Compare
Choose a tag to compare

This gem is good as it is: there is nothing to add and nothing to remove. It just works for everyone.

Declare gem as stable. No changes since 0.1.5.

See #11 for discussion.

Enable ActiveRecord 4.2 support

01 May 08:58
57ad6aa
Compare
Choose a tag to compare