Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Oct 22, 2024
2 parents 346f49f + 5e1330e commit 453e49a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions NewLife.Redis/Queues/RedisQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public Int32 Add(params T[] values)
{
if (timeout < 0) return Execute((rc, k) => rc.Execute<T>("RPOP", Key), true);

if (timeout > 0 && Redis.Timeout < timeout * 1000) Redis.Timeout = (timeout + 1) * 1000;
if (timeout > 0 && Redis.Timeout < (timeout + 1) * 1000) Redis.Timeout = (timeout + 1) * 1000;

var rs = Execute((rc, k) => rc.Execute<IPacket[]>("BRPOP", Key, timeout), true);
return rs == null || rs.Length < 2 ? default : (T?)Redis.Encoder.Decode(rs[1], typeof(T));
Expand All @@ -123,7 +123,7 @@ public Int32 Add(params T[] values)
{
if (timeout < 0) return await ExecuteAsync((rc, k) => rc.ExecuteAsync<T>("RPOP", Key), true);

if (timeout > 0 && Redis.Timeout < timeout * 1000) Redis.Timeout = (timeout + 1) * 1000;
if (timeout > 0 && Redis.Timeout < (timeout + 1) * 1000) Redis.Timeout = (timeout + 1) * 1000;

var rs = await ExecuteAsync((rc, k) => rc.ExecuteAsync<IPacket[]>("BRPOP", new Object[] { Key, timeout }, cancellationToken), true);
return rs == null || rs.Length < 2 ? default : (T?)Redis.Encoder.Decode(rs[1], typeof(T));
Expand Down
2 changes: 1 addition & 1 deletion NewLife.Redis/Queues/RedisReliableQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public Int32 Add(params T[] values)
{
RetryAck();

if (timeout > 0 && Redis.Timeout < timeout * 1000) Redis.Timeout = (timeout + 1) * 1000;
if (timeout > 0 && Redis.Timeout < (timeout + 1) * 1000) Redis.Timeout = (timeout + 1) * 1000;

var rs = timeout >= 0 ?
Execute((rc, k) => rc.Execute<T>("BRPOPLPUSH", Key, AckKey, timeout), true) :
Expand Down

0 comments on commit 453e49a

Please sign in to comment.