Skip to content

Commit f5a84ab

Browse files
committed
prevent dotnet worker from consuming all cpu
1 parent a58579e commit f5a84ab

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

worker/src/Worker/Program.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ public static int Main(string[] args)
2828
var definition = new { vote = "", voter_id = "" };
2929
while (true)
3030
{
31+
// Slow down to prevent CPU spike, only query each 100ms
32+
Thread.Sleep(100);
33+
3134
// Reconnect redis if down
3235
if (redisConn == null || !redisConn.IsConnected) {
3336
Console.WriteLine("Reconnecting Redis");

0 commit comments

Comments
 (0)