Skip to content

Commit

Permalink
Remove Hyrax::Actors::TransactionalRequest from default middleware
Browse files Browse the repository at this point in the history
The actor stack involves writing to several diffrent persistence layers; at
least:

  - ActiveRecord
  - ActiveFedora (Fedora/Solr)
  - ActiveJob

The transactionality provided by `Hyrax::Actors::TransactionalRequest` addresses
only one of these (ActiveRecord). Routinely, failures in the actor stack that
trigger transaction rollback there lead to broken states across the various data
stores.

Additionally, this rollback is not triggered for the main documented failure API
for the stack (returning `false`). Rollback only happens when uncaught errors
are propagated to the top of the stack.

Since this middleware is problematic and doesn't have a clear documented use
case, this proposes its removal.

Fixes #3128.
  • Loading branch information
Tom Johnson committed Jan 25, 2019
1 parent f40bc13 commit e61d19d
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions app/services/hyrax/default_middleware_stack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ class DefaultMiddlewareStack
# rubocop:disable Metrics/MethodLength
def self.build_stack
ActionDispatch::MiddlewareStack.new.tap do |middleware|
# Wrap everything in a database transaction, if the save of the resource
# fails then roll back any database AdminSetChangeSet
middleware.use Hyrax::Actors::TransactionalRequest

# Ensure you are mutating the most recent version
middleware.use Hyrax::Actors::OptimisticLockValidator

Expand Down

0 comments on commit e61d19d

Please sign in to comment.