Sha256: 7f1744cf787e85a8a95dcd009afb11b107e01ab93172db191c271f8a1665d3d0

Contents?: true

Size: 1.14 KB

Versions: 10

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true
# Cache the datetime_stamp of the last time the performance month graph was generated.  Calls job to generate the graph if expired.
module QaServer
  class PerformanceMonthGraphCache
    class << self
      # Generates graphs for the past 30 days for :search, :fetch, and :all actions for each authority.
      # @param force [Boolean] if true, run the tests even if the cache hasn't expired; otherwise, use cache if not expired
      def generate_graphs(force: false)
        Rails.cache.fetch(cache_key, expires_in: next_expiry, race_condition_ttl: 30.seconds, force: force) do
          QaServer.config.monitor_logger.debug("(QaServer::PerformanceMonthGraphCache) - KICKING OFF PERFORMANCE MONTH GRAPH GENERATION (force: #{force})")
          QaServer::PerformanceMonthGraphJob.perform_later
          "Graphs generation initiated at #{QaServer::TimeService.current_time}"
        end
      end

    private

      def cache_key
        "QaServer::PerformanceMonthGraphCache.generate_graphs--latest_generation_initiated"
      end

      def next_expiry
        QaServer::CacheExpiryService.cache_expiry
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
qa_server-8.0.1 app/cache_processors/qa_server/performance_month_graph_cache.rb
qa_server-7.9.2 app/cache_processors/qa_server/performance_month_graph_cache.rb
qa_server-7.9.1 app/cache_processors/qa_server/performance_month_graph_cache.rb
qa_server-7.9.0 app/cache_processors/qa_server/performance_month_graph_cache.rb
qa_server-7.8.0 app/cache_processors/qa_server/performance_month_graph_cache.rb
qa_server-7.7.1 app/cache_processors/qa_server/performance_month_graph_cache.rb
qa_server-7.7.0 app/cache_processors/qa_server/performance_month_graph_cache.rb
qa_server-7.6.0 app/cache_processors/qa_server/performance_month_graph_cache.rb
qa_server-7.5.1 app/cache_processors/qa_server/performance_month_graph_cache.rb
qa_server-7.5.0 app/cache_processors/qa_server/performance_month_graph_cache.rb