瀏覽代碼

Use KeyExistsAsync for exists check (#1004)

master
Weihan Li 3 年之前
committed by GitHub
父節點
當前提交
166773dd11
沒有發現已知的金鑰在資料庫的簽署中 GPG Key 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))


Loading…
取消
儲存