0

我不确定发生了什么。我的应用程序运行良好,现在它经常因此错误而失败。我正在使用 Capistrano 和 Unicorn。

每次只需cap deploy再次运行即可解决问题,但不久之后它就会中断。

Started POST "/monitorings" for 21.987.109.224 at 2012-06-20 08:05:49 +0100
Processing by MonitoringsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"#", "monitoring"=>{"inspection_type"=>"Intensive", "is_revoked"=>"0", "note_attributes"=>{"content"=>"", "attention_required"=>"0", "resolved"=>"0"}, "scenario_ids"=>[""], "outlet_id"=>"560"}, "commit"=>"Save"}
Expire fragment (?-mix:daily) (7.7ms)
Completed 500 Internal Server Error in 26ms

ArgumentError (invalid %-encoding (0607214051%2Fregions%2F11-20120607201444%2Fregions%2F38-20120618184202%2Fregions%2F3-20120409175338%2Fregions%2F36-20120618184137%2Fregions%2F12-20120607202042%2Fregions%2F13-20120607202050%2Fregions%2F37-20120618184150%2Fregions%/2F14-20120607202100%2Fregions%2F6-20120607201339%2Fregions%2F15-20120607202119%2Fregions%2F1-20120409175338%2Fregions%2F16-20120607202129%2Fregions%2F39-20120618184218%2Fregions%2F17-20120607202139%2Fregions%2F40-20120618184229%2F/regions%2F4-20120603182949%2Fregions%2F18-20120607202152%2Fregions%2F19-20120607202200%2Fregions%2F20-20120607202209%2Fregions%2F21-20120607202215%2Fregions%2F22-20120607202223%2Fregions%2F23-20120607202229%2Fregions%2F24-20120607/202236%2Fregions%2F41-20120618184240%2Fregions%2F25-20120607202245%2Fregions%2F26-20120607202253%2Fregions%2F42-20120618184248%2Fregions%2F43-20120618184256%2Fregions%2F27-20120607202301%2Fregions%2F28-20120607213722%2Fregions%2F2/9-20120607202317%2Fregions%2F30-20120607202324%2Fregions%2F44-20120618184306%2Fregions%2F31-20120607202332%2Fregions%2F45-20120618184313%2Fregions%2F32-20120607202339%2Fregions%2F34-20120607202355)):
  app/sweepers/outlet_sweeper.rb:13:in `expire_cache'
  app/sweepers/outlet_sweeper.rb:5:in `after_update'
  app/controllers/monitorings_controller.rb:114:in `after_create'
  app/controllers/monitorings_controller.rb:54:in `create'
  config/initializers/quiet_assets.rb:6:in `call_with_quiet_assets'

该应用程序托管在运行 Ubuntu 10.04 的 VPS 上,据我所知,它是完全最新的(我运行过apt-get upgrade && apt-get install)。

以防万一有人想知道,扫地机是:

class OutletSweeper < ActionController::Caching::Sweeper
  observe Outlet

  def after_update(outlet)
    expire_cache
  end

  # expire_fragment calls moved to their own method
  def expire_cache

    @controller ||= ActionController::Base.new

    expire_fragment(%r{daily})
    puts "Expired Daily Cache"

    expire_fragment(%r{weekly})
    puts "Expired Weekly Cache"
  end

  # Allows us to call the expire_cache method from rake
  def self.rake_sweep
    puts "Begining Expire Cache"
    new.expire_cache
  end

end
4

1 回答 1

1

这可以通过在清扫器中更改以下内容来解决:

expire_fragment(%r{daily})
puts "Expired Daily Cache"

expire_fragment(%r{weekly})
puts "Expired Weekly Cache"

到:

expire_fragment "daily"
puts "Expired Daily Cache"

expire_fragment "weekly"
puts "Expired Weekly Cache"
于 2012-07-06T09:22:00.973 回答