Optimize background services.

This commit is contained in:
Haiping Chen 2024-11-04 16:06:34 -06:00
parent fd0897019b
commit aeaaa3cf75

View file

@ -31,7 +31,7 @@ public class DistributedLocker
} }
} }
public async Task<T> Lock<T>(string resource, Func<T> action, int timeoutInSeconds = 30) public async Task Lock(string resource, Action action, int timeoutInSeconds = 30)
{ {
await ConnectToRedis(); await ConnectToRedis();
@ -45,7 +45,7 @@ public class DistributedLocker
Serilog.Log.Logger.Error($"Acquire lock for {resource} failed due to after {timeout}s timeout."); Serilog.Log.Logger.Error($"Acquire lock for {resource} failed due to after {timeout}s timeout.");
} }
return action(); action();
} }
} }