diff options
author | Nick Thomas <nick@gitlab.com> | 2017-04-10 19:50:48 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-04-21 11:52:28 +0100 |
commit | e9819de10aa1ca29cb760c714c37ab0a23c0bd89 (patch) | |
tree | 5fa50e7464ae0239b885cd9d0d9271b393263d6d /app | |
parent | 6647542cd4db5f5aba36ae7d7d029bdaf8b59a35 (diff) | |
download | gitlab-ce-e9819de10aa1ca29cb760c714c37ab0a23c0bd89.tar.gz |
Remove the ClearDatabaseCacheWorker
Diffstat (limited to 'app')
-rw-r--r-- | app/models/concerns/cache_markdown_field.rb | 25 | ||||
-rw-r--r-- | app/workers/clear_database_cache_worker.rb | 24 |
2 files changed, 0 insertions, 49 deletions
diff --git a/app/models/concerns/cache_markdown_field.rb b/app/models/concerns/cache_markdown_field.rb index 8ea95beed79..f5a70040ee9 100644 --- a/app/models/concerns/cache_markdown_field.rb +++ b/app/models/concerns/cache_markdown_field.rb @@ -30,28 +30,6 @@ module CacheMarkdownField end end - # Dynamic registries don't really work in Rails as it's not guaranteed that - # every class will be loaded, so hardcode the list. - CACHING_CLASSES = %w[ - AbuseReport - Appearance - ApplicationSetting - BroadcastMessage - Issue - Label - MergeRequest - Milestone - Namespace - Note - Project - Release - Snippet - ].freeze - - def self.caching_classes - CACHING_CLASSES.map(&:constantize) - end - def skip_project_check? false end @@ -107,9 +85,6 @@ module CacheMarkdownField # a corresponding _html field. Any custom rendering options may be provided # as a context. def cache_markdown_field(markdown_field, context = {}) - raise "Add #{self} to CacheMarkdownField::CACHING_CLASSES" unless - CacheMarkdownField::CACHING_CLASSES.include?(self.to_s) - cached_markdown_fields[markdown_field] = context html_field = cached_markdown_fields.html_field(markdown_field) diff --git a/app/workers/clear_database_cache_worker.rb b/app/workers/clear_database_cache_worker.rb deleted file mode 100644 index c4cb4733482..00000000000 --- a/app/workers/clear_database_cache_worker.rb +++ /dev/null @@ -1,24 +0,0 @@ -# This worker clears all cache fields in the database, working in batches. -class ClearDatabaseCacheWorker - include Sidekiq::Worker - include DedicatedSidekiqQueue - - BATCH_SIZE = 1000 - - def perform - CacheMarkdownField.caching_classes.each do |kls| - fields = kls.cached_markdown_fields.html_fields - clear_cache_fields = fields.each_with_object({}) do |field, memo| - memo[field] = nil - end - - Rails.logger.debug("Clearing Markdown cache for #{kls}: #{fields.inspect}") - - kls.unscoped.in_batches(of: BATCH_SIZE) do |relation| - relation.update_all(clear_cache_fields) - end - end - - nil - end -end |