Using timeout to Limit the Voting Process

in #witness-category3 years ago

Last time, i talked about exiting the process if it takes too long by checking the time difference since process started (here)

Apparently, it didn't work quite well, and I was still able to see processes being stuck and couldn't exit properly.

image.png

Luckily I found out there is a command timeout which works like a charm:

image.png

For example:

timeout 5 sleep 100 will exit the process after 5 seconds and sets $? to 124 error code.
but timeout 5 sleep 4 will exit the process after 4 seconds and sets $? to 0 error code.

I have set timeout 10 minutes (600 seconds) for voting process to run.

And so far so good!

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Thank you for reading ^^^^^^^^^^^^^^^

Follow me for topics of Algorithms, Blockchain and Cloud.
I am @justyy - a Steem Witness
https://steemyy.com

My contributions

Delegation Service

  1. Voting Algorithm Updated to Favor those High Delegations!
  • Delegate 1000 to justyy: Link
  • Delegate 5000 to justyy: Link
  • Delegate 10000 to justyy: Link

Support me

If you like my work, please:

  1. Delegate SP: https://steemyy.com/sp-delegate-form/?delegatee=justyy
  2. Vote @justyy as Witness: https://steemyy.com/witness-voting/?witness=justyy&action=approve
  3. Set @justyy as Proxy: https://steemyy.com/witness-voting/?witness=justyy&action=proxy
    Alternatively, you can vote witness or set proxy here: https://steemit.com/~witnesses

Coin Marketplace

STEEM 0.28
TRX 0.11
JST 0.034
BTC 66396.53
ETH 3174.43
USDT 1.00
SBD 4.15