Skip to content

Commit

Permalink
prevent dotnet worker from consuming all cpu
Browse files Browse the repository at this point in the history
  • Loading branch information
BretFisher committed Nov 21, 2017
1 parent a58579e commit f5a84ab
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions worker/src/Worker/Program.cs
Expand Up @@ -28,6 +28,9 @@ public static int Main(string[] args)
var definition = new { vote = "", voter_id = "" };
while (true)
{
// Slow down to prevent CPU spike, only query each 100ms
Thread.Sleep(100);

// Reconnect redis if down
if (redisConn == null || !redisConn.IsConnected) {
Console.WriteLine("Reconnecting Redis");
Expand Down

0 comments on commit f5a84ab

Please sign in to comment.