Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Never return Concurrent::ThreadLocalVar instances directly

Christophe Bliarda4364380ddd9
diff --git a/app/models/journal/notification_configuration.rb b/app/models/journal/notification_configuration.rb
index 48488591f6e..26473af5fe6 100644
--- a/app/models/journal/notification_configuration.rb
+++ b/app/models/journal/notification_configuration.rb
@@ -47,7 +47,8 @@ class Journal::NotificationConfiguration
end
def active?
- active.value
+ @active ||= Concurrent::ThreadLocalVar.new(DEFAULT)
+ @active.value
end
protected
@@ -73,20 +74,13 @@ class Journal::NotificationConfiguration
Rails.logger.debug message.strip
end
- def active
- @active ||= Concurrent::ThreadLocalVar.new(DEFAULT)
- end
-
- def already_set
- @already_set ||= Concurrent::ThreadLocalVar.new(false)
+ def active=(value)
+ @active.value = value
end
def already_set?
- already_set.value
- end
-
- def active=(value)
- @active.value = value
+ @already_set ||= Concurrent::ThreadLocalVar.new(false)
+ @already_set.value
end
def already_set=(value)