From 166773dd1110f2b8d4e363c7f0e1808119966284 Mon Sep 17 00:00:00 2001 From: Weihan Li Date: Sun, 26 Sep 2021 15:36:11 +0800 Subject: [PATCH] Use KeyExistsAsync for exists check (#1004) --- .../IRedisStream.Manager.Default.cs | 4 ++-- .../IRedisStream.Manager.Extensions.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/DotNetCore.CAP.RedisStreams/IRedisStream.Manager.Default.cs b/src/DotNetCore.CAP.RedisStreams/IRedisStream.Manager.Default.cs index 03b3267..ba446a8 100644 --- a/src/DotNetCore.CAP.RedisStreams/IRedisStream.Manager.Default.cs +++ b/src/DotNetCore.CAP.RedisStreams/IRedisStream.Manager.Default.cs @@ -34,8 +34,8 @@ namespace DotNetCore.CAP.RedisStreams //The object returned from GetDatabase is a cheap pass - thru object, and does not need to be stored var database = _redis.GetDatabase(); - var streamExist = await database.KeyTypeAsync(stream); - if (streamExist == RedisType.None) + var streamExist = await database.KeyExistsAsync(stream); + if (!streamExist) { await database.StreamCreateConsumerGroupAsync(stream, consumerGroup, StreamPosition.NewMessages); } diff --git a/src/DotNetCore.CAP.RedisStreams/IRedisStream.Manager.Extensions.cs b/src/DotNetCore.CAP.RedisStreams/IRedisStream.Manager.Extensions.cs index 235a3a9..5250264 100644 --- a/src/DotNetCore.CAP.RedisStreams/IRedisStream.Manager.Extensions.cs +++ b/src/DotNetCore.CAP.RedisStreams/IRedisStream.Manager.Extensions.cs @@ -19,8 +19,8 @@ namespace DotNetCore.CAP.RedisStreams try { var stream = position.Key; - var streamExist = await database.KeyTypeAsync(stream); - if (streamExist == RedisType.None) + var streamExist = await database.KeyExistsAsync(stream); + if (!streamExist) { if (await database.StreamCreateConsumerGroupAsync(stream, consumerGroup, StreamPosition.NewMessages))