diff --git a/app/models/configuration.rb b/app/models/configuration.rb --- a/app/models/configuration.rb +++ b/app/models/configuration.rb @@ -6,6 +6,7 @@ class Configuration < ActiveRecord::Base SYSTEM_MODE_CONF_KEY = 'system.mode' + TEST_REQUEST_EARLY_TIMEOUT_KEY = 'contest.test_request.early_timeout' # set @@cache = true to only reload once. @@cache = false @@ -36,6 +37,10 @@ @@configurations = nil end + def self.cache? + @@cache + end + def self.enable_caching @@cache = true end @@ -67,8 +72,11 @@ def self.allow_test_request(user) mode = get(SYSTEM_MODE_CONF_KEY) + early_timeout = get(TEST_REQUEST_EARLY_TIMEOUT_KEY) if (mode=='contest') - return false if (user.site!=nil) and ((user.site.started!=true) or (user.site.time_left < 30.minutes)) + return false if ((user.site!=nil) and + ((user.site.started!=true) or + (early_timeout and (user.site.time_left < 30.minutes)))) end return false if mode=='analysis' return true