fix failsafe on pipelined

refs CNVS-60234

`...` was stuffing the failsafe kwarg into a hash as the
first non-kwarg

Change-Id: Ia0b468416be130e1134b5e814f69faac9581f9f2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/331323
Reviewed-by: Ryan Norton <rnorton@instructure.com>
Product-Review: Ryan Norton <rnorton@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2023-10-25 12:57:44 -06:00
parent 24fb09df23
commit 551f264073
2 changed files with 11 additions and 2 deletions

View File

@ -44,9 +44,9 @@ module CanvasCache
end
module IgnorePipelinedKey
def pipelined(_key = nil, ...)
def pipelined(_key = nil, **kwargs, &)
# ignore key; only useful for distributed
super(...)
super(**kwargs, &)
end
end

View File

@ -295,6 +295,15 @@ describe CanvasCache::Redis do
allow(Process).to receive(:clock_gettime).and_return(now + 4)
expect { redis_client.get("mykey") }.to raise_error(Redis::CannotConnectError)
end
it "support failsafe with pipeline" do
expect(redis_client.pipelined(failsafe: 2) { raise Redis::CannotConnectError }).to eq(2)
end
it "support failsafe with pipeline on a distributed client" do
client = Redis::Distributed.new([redis_client.id])
expect(client.pipelined("key", failsafe: 2) { raise Redis::CannotConnectError }).to eq(2)
end
end
end
end