prevent dotnet worker from consuming all cpu

This commit is contained in:
Bret Fisher 2017-11-21 02:11:55 -05:00
parent a58579e442
commit f5a84ab40f

View File

@ -28,6 +28,9 @@ namespace Worker
var definition = new { vote = "", voter_id = "" }; var definition = new { vote = "", voter_id = "" };
while (true) while (true)
{ {
// Slow down to prevent CPU spike, only query each 100ms
Thread.Sleep(100);
// Reconnect redis if down // Reconnect redis if down
if (redisConn == null || !redisConn.IsConnected) { if (redisConn == null || !redisConn.IsConnected) {
Console.WriteLine("Reconnecting Redis"); Console.WriteLine("Reconnecting Redis");