Преглед на файлове

Use KeyExistsAsync for exists check (#1004)

master
Weihan Li преди 3 години
committed by GitHub
родител
ревизия
166773dd11
No known key found for this signature in database GPG ключ ID: 4AEE18F83AFDEB23
променени са 2 файла, в които са добавени 4 реда и са изтрити 4 реда
  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 Целия файл

@@ -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 Целия файл

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


Зареждане…
Отказ
Запис