Merge pull request #92 from BretFisher/master
prevent dotnet worker from consuming all cpu
This commit is contained in:
		@@ -1,4 +1,5 @@
 | 
				
			|||||||
FROM node:8.9-slim
 | 
					FROM node:8.9-slim
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN apt-get update -qq && apt-get install -qy \ 
 | 
					RUN apt-get update -qq && apt-get install -qy \ 
 | 
				
			||||||
    ca-certificates \
 | 
					    ca-certificates \
 | 
				
			||||||
    bzip2 \
 | 
					    bzip2 \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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");
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user