Merge pull request #92 from BretFisher/master
prevent dotnet worker from consuming all cpu
This commit is contained in:
commit
3a5539927b
@ -1,5 +1,6 @@
|
|||||||
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 \
|
||||||
curl \
|
curl \
|
||||||
|
@ -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");
|
||||||
|
Loading…
Reference in New Issue
Block a user