Skip to content
Snippets Groups Projects
Commit c28d1120 authored by Robert Martin-Legene's avatar Robert Martin-Legene
Browse files

Ignore errors when monitor.js can not connect. Also, use Date.now() correctly.

parent a499e066
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
trap 'exit 1' ERR trap 'exit 1' ERR
# Go $HOME
cd
# Log in home directory # Log in home directory
exec < /dev/null > bfa-cron-output.log 2>&1 exec < /dev/null > ${HOME}/bfa-cron-output.log 2>&1
# Go to script bin, 'cause we expect to find $BFAHOME/bin/env there # Go to script bin, 'cause we expect to find $BFAHOME/bin/env there
cd `dirname $0` cd `dirname $0`
source ./env source ./env
......
...@@ -101,7 +101,7 @@ function peerlist() ...@@ -101,7 +101,7 @@ function peerlist()
}, },
function failedToGetAdminPeers(x) function failedToGetAdminPeers(x)
{ {
console.log( x ); // ignore connection problems?
} }
); );
} }
...@@ -156,17 +156,15 @@ function mayseal() ...@@ -156,17 +156,15 @@ function mayseal()
function failedToGetIsMiningBool(x) function failedToGetIsMiningBool(x)
{ {
// Probably geth is not running. // Probably geth is not running.
console.log(x); //console.log(x);
} }
); );
} }
function unlock() function unlock()
{ {
var now = new Date(); if ( lastUnlock + 600 > Date.now() / 1000 )
if ( lastUnlock + 600 > now )
return; return;
lastUnlock = now;
web3.eth.personal.bfalistWallets() web3.eth.personal.bfalistWallets()
.then( .then(
function pushone(x) function pushone(x)
...@@ -192,6 +190,7 @@ function unlock() ...@@ -192,6 +190,7 @@ function unlock()
promises.push( promise ); promises.push( promise );
} }
} }
lastUnlock = Date.now() / 1000;
} }
, ,
function err(x) function err(x)
...@@ -208,5 +207,5 @@ function timer() ...@@ -208,5 +207,5 @@ function timer()
unlock(); unlock();
} }
peerlist(); setTimeout( timer, 5 * 1000 );
setInterval( timer, 60 * 1000 ); setInterval( timer, 60 * 1000 );
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment