Simple Solution to Fix the Voting Program

in #blog2 months ago

Previously, the voting services were not stable - with some votes missing. I have now tried a few improvements and let it run a few days, and it turns out it is quite stable now.

So TLDR; the solution is:

  1. moving to a better VPS provider i.e. hetzner
  2. run the voting service continuously in a screen session rather than a crontab.
  3. timeout the program in case it got stuck.

See following:

#!/bin/bash

i=0
while :
do
        i=$((i+1))
        date
        echo ---------------Counter $i------------------
        timeout 1200 node voting.js
        sleep 5
done

Steem to the Moon🚀!

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.030
BTC 65733.39
ETH 3506.40
USDT 1.00
SBD 2.51