feat: add GenericNotFoundError error response and set_key_if_not_exists_with_expiry Redis command (#1526)

This commit is contained in:
Prajjwal Kumar
2023-07-03 18:21:23 +05:30
committed by GitHub
parent 1e87f3d673
commit 9a88a32d50
5 changed files with 22 additions and 6 deletions

View File

@ -83,7 +83,9 @@ impl QueueInterface for Store {
ttl: i64,
) -> CustomResult<bool, RedisError> {
let conn = self.redis_conn()?.clone();
let is_lock_acquired = conn.set_key_if_not_exist(lock_key, lock_val).await;
let is_lock_acquired = conn
.set_key_if_not_exists_with_expiry(lock_key, lock_val, None)
.await;
Ok(match is_lock_acquired {
Ok(SetnxReply::KeySet) => match conn.set_expiry(lock_key, ttl).await {
Ok(()) => true,