diff --git a/build/common.props b/build/common.props index c1f8e80..451c591 100644 --- a/build/common.props +++ b/build/common.props @@ -39,7 +39,7 @@ - + diff --git a/src/Foundatio.Redis/Foundatio.Redis.csproj b/src/Foundatio.Redis/Foundatio.Redis.csproj index 09118c9..3b72047 100644 --- a/src/Foundatio.Redis/Foundatio.Redis.csproj +++ b/src/Foundatio.Redis/Foundatio.Redis.csproj @@ -3,7 +3,7 @@ - + diff --git a/src/Foundatio.Redis/Queues/RedisQueue.cs b/src/Foundatio.Redis/Queues/RedisQueue.cs index 5d6f36f..86e48c7 100644 --- a/src/Foundatio.Redis/Queues/RedisQueue.cs +++ b/src/Foundatio.Redis/Queues/RedisQueue.cs @@ -371,7 +371,7 @@ private async Task DequeueIdAsync(CancellationToken linkedCancellati workListName = _workListName, queueName = _options.Name, now, - timeout = timeout.TotalSeconds + timeout = timeout.TotalMilliseconds }).AnyContext(); return result.ToString(); }, 3, TimeSpan.FromMilliseconds(100), linkedCancellationToken, _logger).AnyContext(); diff --git a/tests/Foundatio.Redis.Tests/Locks/RedisLockTests.cs b/tests/Foundatio.Redis.Tests/Locks/RedisLockTests.cs index 58fcd7a..5c5cb19 100644 --- a/tests/Foundatio.Redis.Tests/Locks/RedisLockTests.cs +++ b/tests/Foundatio.Redis.Tests/Locks/RedisLockTests.cs @@ -32,6 +32,11 @@ protected override ILockProvider GetLockProvider() { return new CacheLockProvider(_cache, _messageBus, Log); } + [Fact] + public override Task CanAcquireLocksInParallel() { + return base.CanAcquireLocksInParallel(); + } + [Fact] public override Task CanAcquireAndReleaseLockAsync() { return base.CanAcquireAndReleaseLockAsync(); diff --git a/tests/Foundatio.Redis.Tests/Queues/RedisQueueTests.cs b/tests/Foundatio.Redis.Tests/Queues/RedisQueueTests.cs index e8ba399..01b4af9 100644 --- a/tests/Foundatio.Redis.Tests/Queues/RedisQueueTests.cs +++ b/tests/Foundatio.Redis.Tests/Queues/RedisQueueTests.cs @@ -190,6 +190,7 @@ public async Task VerifyCacheKeysAreCorrect() { _logger.LogInformation("-----"); + Assert.False(await db.KeyExistsAsync("q:SimpleWorkItem:" + id + ":renewed")); var workItem = await queue.DequeueAsync(); Assert.True(await db.KeyExistsAsync("q:SimpleWorkItem:" + id)); Assert.Equal(0, await db.ListLengthAsync($"{listPrefix}:in")); @@ -199,6 +200,16 @@ public async Task VerifyCacheKeysAreCorrect() { Assert.True(await db.KeyExistsAsync("q:SimpleWorkItem:" + id + ":dequeued")); Assert.Equal(5, await muxer.CountAllKeysAsync()); + await Task.Delay(TimeSpan.FromSeconds(4)); + + Assert.True(await db.KeyExistsAsync("q:SimpleWorkItem:" + id)); + Assert.Equal(0, await db.ListLengthAsync($"{listPrefix}:in")); + Assert.Equal(1, await db.ListLengthAsync($"{listPrefix}:work")); + Assert.True(await db.KeyExistsAsync("q:SimpleWorkItem:" + id + ":enqueued")); + Assert.True(await db.KeyExistsAsync("q:SimpleWorkItem:" + id + ":renewed")); + Assert.True(await db.KeyExistsAsync("q:SimpleWorkItem:" + id + ":dequeued")); + Assert.Equal(5, await muxer.CountAllKeysAsync()); + _logger.LogInformation("-----"); await workItem.CompleteAsync();