Commit 91b4a646 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Remove dependency list usage data from Redis

This removes any existing counters for the dependency list usage data
from Redis. Freeing up the memory it was taking.

Changelog: other
EE: true
parent 22c0c91c
# frozen_string_literal: true
class RemoveDependencyListUsageDataFromRedis < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
def up
Gitlab::Redis::SharedState.with { |r| r.del("DEPENDENCY_LIST_USAGE_COUNTER") }
end
def down
# no-op
end
end
39785d4140c7345ddbe62417576381654ce22d505ee5c92a84425f0a3f8e4935
\ No newline at end of file
# frozen_string_literal: true
require 'spec_helper'
require_migration!
RSpec.describe RemoveDependencyListUsageDataFromRedis, :migration, :clean_gitlab_redis_shared_state do
let(:key) { "DEPENDENCY_LIST_USAGE_COUNTER" }
describe "#up" do
it 'removes the hash from redis' do
with_redis do |redis|
redis.hincrby(key, 1, 1)
redis.hincrby(key, 2, 1)
end
expect { migrate! }.to change { with_redis { |r| r.hgetall(key) } }.from({ '1' => '1', '2' => '1' }).to({})
end
end
def with_redis(&block)
Gitlab::Redis::SharedState.with(&block)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment