From 16fbbd096a6afbd7eefc1b8dd8048a8ad9474779 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 22 Feb 2019 20:53:09 +0000 Subject: [PATCH] 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. --- lib/stylesheet/watcher.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/stylesheet/watcher.rb b/lib/stylesheet/watcher.rb index e2425c4fd72..7d73ec51160 100644 --- a/lib/stylesheet/watcher.rb +++ b/lib/stylesheet/watcher.rb @@ -2,16 +2,14 @@ require 'listen' module Stylesheet class Watcher + REDIS_KEY = "dev_last_used_theme_id" def self.theme_id=(v) - @theme_id = v + $redis.set(REDIS_KEY, v) end def self.theme_id - if @theme_id.blank? && SiteSetting.default_theme_id != -1 - @theme_id = SiteSetting.default_theme_id - end - @theme_id + ($redis.get(REDIS_KEY) || SiteSetting.default_theme_id).to_i end def self.watch(paths = nil)