Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions src/NRedisStack/Auxiliary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,28 @@ public static IDatabase GetDatabase(this ConnectionMultiplexer redis,
return _db;
}

private static void SetInfoInPipeline(this IDatabase db)
internal static void SetInfoInPipeline(this IDatabase db)
{
if (_libraryName == null) return;
Pipeline pipeline = new Pipeline(db);
_ = pipeline.Db.ClientSetInfoAsync(SetInfoAttr.LibraryName, _libraryName!);
_ = pipeline.Db.ClientSetInfoAsync(SetInfoAttr.LibraryVersion, GetNRedisStackVersion());
pipeline.Execute();
if (_setInfo)
{
_setInfo = false;
if (_libraryName == null) return;
Pipeline pipeline = new Pipeline(db);
_ = pipeline.Db.ClientSetInfoAsync(SetInfoAttr.LibraryName, _libraryName!);
_ = pipeline.Db.ClientSetInfoAsync(SetInfoAttr.LibraryVersion, GetNRedisStackVersion());
pipeline.Execute();
}
}

public static RedisResult Execute(this IDatabase db, SerializedCommand command)
{
if (!_setInfo) return db.Execute(command.Command, command.Args);
_setInfo = false;
db.SetInfoInPipeline();
return db.Execute(command.Command, command.Args);
}

public static async Task<RedisResult> ExecuteAsync(this IDatabaseAsync db, SerializedCommand command)
{
if (_setInfo)
{
_setInfo = false;
((IDatabase)db).SetInfoInPipeline();
}
((IDatabase)db).SetInfoInPipeline();
return await db.ExecuteAsync(command.Command, command.Args);
}

Expand Down
1 change: 1 addition & 0 deletions src/NRedisStack/Transactions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class Transaction

public Transaction(IDatabase db)
{
db.SetInfoInPipeline();
_transaction = db.CreateTransaction();
}

Expand Down