DEV: Fix live CSS watching when viewing non-default theme
State was being stored in a class variable, so was not consistent across processes. This commit moves the storage to redis. The change only affects development environments.
This commit is contained in:
parent
8be7878656
commit
16fbbd096a
|
@ -2,16 +2,14 @@ require 'listen'
|
||||||
|
|
||||||
module Stylesheet
|
module Stylesheet
|
||||||
class Watcher
|
class Watcher
|
||||||
|
REDIS_KEY = "dev_last_used_theme_id"
|
||||||
|
|
||||||
def self.theme_id=(v)
|
def self.theme_id=(v)
|
||||||
@theme_id = v
|
$redis.set(REDIS_KEY, v)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.theme_id
|
def self.theme_id
|
||||||
if @theme_id.blank? && SiteSetting.default_theme_id != -1
|
($redis.get(REDIS_KEY) || SiteSetting.default_theme_id).to_i
|
||||||
@theme_id = SiteSetting.default_theme_id
|
|
||||||
end
|
|
||||||
@theme_id
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.watch(paths = nil)
|
def self.watch(paths = nil)
|
||||||
|
|
Loading…
Reference in New Issue