Class: SolidObserver::Services::CleanupStorage

Inherits:
Object
  • Object
show all
Defined in:
lib/solid_observer/services/cleanup_storage.rb

Constant Summary collapse

MAINTENANCE_STATEMENT_BUILDERS =
{
  "sqlite" => ->(_tables) { ["VACUUM"] },
  "postgresql" => ->(tables) { tables.map { |table_name| "VACUUM ANALYZE #{table_name}" } },
  "mysql2" => ->(tables) { ["OPTIMIZE TABLE #{tables.join(", ")}"] },
  "trilogy" => ->(tables) { ["OPTIMIZE TABLE #{tables.join(", ")}"] }
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.callObject



16
17
18
# File 'lib/solid_observer/services/cleanup_storage.rb', line 16

def self.call
  new.call
end

Instance Method Details

#callObject



20
21
22
23
24
25
26
# File 'lib/solid_observer/services/cleanup_storage.rb', line 20

def call
  return 0 if SolidObserver.config.realtime_mode?

  post_cleanup(cleanup_counts)
rescue => error
  handle_cleanup_failure(error)
end