Commit d0032f80 authored by Tetiana Chupryna's avatar Tetiana Chupryna

Merge branch 'bvl-idempotency-serialization-using-json' into 'master'

Avoid cache misses: Use Sidekiq.dump_json to serialize arguments

See merge request gitlab-org/gitlab!65482
parents 9c2f1e3d bb478db0
......@@ -133,11 +133,7 @@ module Gitlab
end
def idempotency_string
# TODO: dump the argument's JSON using `Sidekiq.dump_json` instead
# this should be done in the next release so all jobs are written
# with their idempotency key.
# see https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/1090
"#{worker_class_name}:#{arguments.join('-')}"
"#{worker_class_name}:#{Sidekiq.dump_json(arguments)}"
end
end
end
......
......@@ -13,7 +13,7 @@ RSpec.describe Gitlab::SidekiqMiddleware::DuplicateJobs::DuplicateJob, :clean_gi
let(:queue) { 'authorized_projects' }
let(:idempotency_key) do
hash = Digest::SHA256.hexdigest("#{job['class']}:#{job['args'].join('-')}")
hash = Digest::SHA256.hexdigest("#{job['class']}:#{Sidekiq.dump_json(job['args'])}")
"#{Gitlab::Redis::Queues::SIDEKIQ_NAMESPACE}:duplicate:#{queue}:#{hash}"
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