Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10408 (closed defect: fixed)

Opened 7 months ago

Last modified 7 months ago

Query Cache fix (changeset 8325) can make code run twice on errors

Reported by: manfred Assigned to: core
Priority: high Milestone: 2.x
Component: ActiveRecord Version: edge
Severity: major Keywords: rails2
Cc:

Description

Some of my actions are run twice because of a double yield in the query cache cache method.

def cache(&block)
  if ActiveRecord::Base.configurations.blank?
    yield
  else
    connection.cache(&block)
  end
rescue
  yield # if the database is not present, don't let the cache spoil the party
end

Note that an uncaught exception in the first yield will case the method to call the block twice. I propose to revert the change for now.

Change History

12/07/07 10:39:18 changed by lifofifo

  • keywords set to rail2.

Looks blocking to me. Adding "rails2" keyword.

12/07/07 10:52:01 changed by lifofifo

  • keywords changed from rail2 to rails2.

12/07/07 13:34:11 changed by david

  • status changed from new to closed.
  • resolution set to fixed.

(In [8329]) Removed query cache rescue as it could cause code to be run twice (closes #10408) [DHH]