Skip to content

Commit

Permalink
fixed a few errors added experimental feedscript scheduling
Browse files Browse the repository at this point in the history
  • Loading branch information
gileadmcgee committed Oct 15, 2015
1 parent a487069 commit 1889ab0
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions scripts/switch-keys/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import time
import config
import subprocess
from time import gmtime, strftime


rpc = GrapheneWebsocket("localhost", 8092, "", "")
Expand Down Expand Up @@ -85,6 +86,26 @@ def resync():
print("waiting...")
time.sleep(10)

### testing running feed schedule through script
#def checkTime(lastHour):
# hour = strftime("%H", gmtime())
# minute = strftime("%M", gmtime())
# hour = int(hour)
# minute = int(minute)
# if minute % 42 == 0:
# if lastHour == 23:
# if hour == 0:
# subprocess.call(["screen","-S","feed","-p","0","-X","quit"])
# subprocess.call(["screen","-dmS","feed","python3",config.path_to_feed_script])
# return hour
# elif hour > lastHour:
# subprocess.call(["screen","-S","feed","-p","0","-X","quit"])
# subprocess.call(["screen","-dmS","feed","python3",config.path_to_feed_script])
# return hour
# else:
# return lastHour
# else:
# return lastHour

closeScreens()
openScreens()
Expand All @@ -97,6 +118,8 @@ def resync():
lastblock = witness["last_confirmed_block_num"]
emergency = False
replay = 0
crash = 0
lastHour = 0

while True:
try:
Expand Down Expand Up @@ -149,8 +172,10 @@ def resync():
print(config.witnessname + " missed a block. total missed = " + str(missed) + " recent missed = " + str(recentmissed))
lastblock = witness["last_confirmed_block_num"]
else:
# lastHour = checkTime(lastHour)
waitAndNotify()
replay = watch(replay)
### if you are having issue try commenting out the try line and everything below the except line to prevent auto restart
except:
if crash > 2:
crash = watch(crash)
Expand Down

0 comments on commit 1889ab0

Please sign in to comment.