debian-mirror-gitlab/spec/support/redis/redis_helpers.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-10-15 14:42:47 +05:30
module RedisHelpers
# config/README.md
# Usage: performance enhancement
def redis_cache_cleanup!
2021-09-30 23:02:18 +05:30
Gitlab::Redis::Cache.with(&:flushdb)
2018-10-15 14:42:47 +05:30
end
# Usage: SideKiq, Mailroom, CI Runner, Workhorse, push services
def redis_queues_cleanup!
2021-09-30 23:02:18 +05:30
Gitlab::Redis::Queues.with(&:flushdb)
2018-10-15 14:42:47 +05:30
end
# Usage: session state, rate limiting
def redis_shared_state_cleanup!
2021-09-30 23:02:18 +05:30
Gitlab::Redis::SharedState.with(&:flushdb)
2018-10-15 14:42:47 +05:30
end
2021-09-04 01:27:46 +05:30
# Usage: CI trace chunks
def redis_trace_chunks_cleanup!
2021-09-30 23:02:18 +05:30
Gitlab::Redis::TraceChunks.with(&:flushdb)
2021-09-04 01:27:46 +05:30
end
2021-11-18 22:05:49 +05:30
# Usage: rate limiting state (for Rack::Attack)
def redis_rate_limiting_cleanup!
Gitlab::Redis::RateLimiting.with(&:flushdb)
end
# Usage: session state
def redis_sessions_cleanup!
Gitlab::Redis::Sessions.with(&:flushdb)
end
2022-01-26 12:08:38 +05:30
# Usage: reset cached instance config
def redis_clear_raw_config!(instance_class)
instance_class.remove_instance_variable(:@_raw_config)
rescue NameError
# raised if @_raw_config was not set; ignore
end
2018-10-15 14:42:47 +05:30
end