[yast-commit] <rest-service> master : don't use background mode if cache_classes = false
ref: refs/heads/master commit ae84b04828b0978e5a5bf0c98ce7e1063dcbb680 Author: Ladislav Slezak <lslezak@novell.com> Date: Wed Nov 11 17:46:12 2009 +0100 don't use background mode if cache_classes = false - static class members are lost on class reloading - increased patch cache validity to 15 minutes (libzypp refreshes the cache only after 10 minutes anyway) --- .../patches/app/controllers/patches_controller.rb | 2 +- plugins/patches/app/models/patch.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/plugins/patches/app/controllers/patches_controller.rb b/plugins/patches/app/controllers/patches_controller.rb index 5552fc1..e60b489 100644 --- a/plugins/patches/app/controllers/patches_controller.rb +++ b/plugins/patches/app/controllers/patches_controller.rb @@ -29,7 +29,7 @@ class PatchesController < ApplicationController # the cache expires after 5 minutes, repository metadata # or RPM database update invalidates the cache immediately # (new patches might be applicable) - elsif cache_timestamp < 5.minutes.ago || cache_timestamp < Patch.mtime + elsif cache_timestamp < 15.minutes.ago || cache_timestamp < Patch.mtime logger.debug "#### Patch cache expired" expire_action :action => :index, :format => params["format"] Rails.cache.write('patches:timestamp', Time.now) diff --git a/plugins/patches/app/models/patch.rb b/plugins/patches/app/models/patch.rb index a6deb90..37c1bfc 100644 --- a/plugins/patches/app/models/patch.rb +++ b/plugins/patches/app/models/patch.rb @@ -35,6 +35,13 @@ class Patch < Resolvable def self.find(what, opts = {}) background = opts[:background] + # background reading doesn't work correctly if class reloading is active + # (static class members are lost between requests) + if background && !Rails.configuration.cache_classes + Rails.logger.info "Class reloading is active, cannot run background thread (set config.cache_classes = true)" + background = false + end + if background if @@done.has_key?(what) Rails.logger.debug "Request #{what} is done" -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
Ladislav Slezak