From a1f9cdfe4a11eff3e2d991b8cdc7c573c6197070 Mon Sep 17 00:00:00 2001 From: jano3 <jano@bob.co.za> Date: Wed, 5 Jun 2024 06:56:54 +0200 Subject: [PATCH] Add keep alive function for locks --- redis/redis.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/redis/redis.go b/redis/redis.go index e4f6ccc..a28528b 100644 --- a/redis/redis.go +++ b/redis/redis.go @@ -290,3 +290,11 @@ func (r ClientWithHelpers) SetLockKey(key string, expiration time.Duration, lock return success, nil } + +func (r ClientWithHelpers) KeepLockKeyAlive(key string, expiration time.Duration) { + if !r.IsConnected() { + return + } + + _ = r.Client.Expire(ctx, key, expiration) +} -- GitLab