Explorar el Código

Use KeyExistsAsync for exists check (#1004)

master
Weihan Li hace 3 años
committed by GitHub
padre
commit
166773dd11
No se encontró ninguna clave conocida en la base de datos para esta firma ID de clave GPG: 4AEE18F83AFDEB23
Se han modificado 2 ficheros con 4 adiciones y 4 borrados
  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 Ver fichero

@@ -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 Ver fichero

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


Cargando…
Cancelar
Guardar