Browse Source

Use KeyExistsAsync for exists check (#1004)

master
Weihan Li 3 years ago
committed by GitHub
parent
commit
166773dd11
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions
  1. +2
    -2
      src/DotNetCore.CAP.RedisStreams/IRedisStream.Manager.Default.cs
  2. +2
    -2
      src/DotNetCore.CAP.RedisStreams/IRedisStream.Manager.Extensions.cs

+ 2
- 2
src/DotNetCore.CAP.RedisStreams/IRedisStream.Manager.Default.cs View File

@@ -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);
}


+ 2
- 2
src/DotNetCore.CAP.RedisStreams/IRedisStream.Manager.Extensions.cs View File

@@ -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))


Loading…
Cancel
Save