Skip to content

Commit

Permalink
Use KeyExistsAsync for exists check (#1004)
Browse files Browse the repository at this point in the history
  • Loading branch information
WeihanLi authored Sep 26, 2021
1 parent 740e95b commit 166773d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public async Task CreateStreamWithConsumerGroupAsync(string stream, string consu

//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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public static async IAsyncEnumerable<StreamPosition> TryCreateConsumerGroup(this
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))
Expand Down

0 comments on commit 166773d

Please sign in to comment.