Skip to content

Commit

Permalink
Renamed to CustomProcedureFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
yrajas committed Nov 11, 2024
1 parent 59d062f commit ca36414
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion libs/server/Custom/CustomCommandManagerSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public CustomProcedure GetCustomProcedure(int id, RespServerSession respServerSe
if (sessionCustomProcMap[id] == null)
{
var entry = customCommandManager.customProcedureMap[id] ?? throw new GarnetException($"Custom procedure {id} not found");
sessionCustomProcMap[id] = entry.CustomProcedure();
sessionCustomProcMap[id] = entry.CustomProcedureFactory();
sessionCustomProcMap[id].respServerSession = respServerSession;
}

Expand Down
10 changes: 5 additions & 5 deletions libs/server/Custom/CustomProcedureWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ class CustomProcedureWrapper
public readonly string NameStr;
public readonly byte[] Name;
public readonly byte Id;
public readonly Func<CustomProcedure> CustomProcedure;
public readonly Func<CustomProcedure> CustomProcedureFactory;

internal CustomProcedureWrapper(string name, byte id, Func<CustomProcedure> customProcedure, CustomCommandManager customCommandManager)
internal CustomProcedureWrapper(string name, byte id, Func<CustomProcedure> customProcedureFactory, CustomCommandManager customCommandManager)
{
if (string.IsNullOrEmpty(name))
throw new ArgumentNullException(nameof(name));

if (customProcedure == null)
throw new ArgumentNullException(nameof(customProcedure));
if (customProcedureFactory == null)
throw new ArgumentNullException(nameof(customProcedureFactory));

Debug.Assert(customCommandManager != null);

NameStr = name.ToUpperInvariant();
Name = System.Text.Encoding.ASCII.GetBytes(NameStr);
Id = id;
CustomProcedure = customProcedure;
CustomProcedureFactory = customProcedureFactory;
}
}
}

0 comments on commit ca36414

Please sign in to comment.