zephyr_mirror: Only resend old messages when invoked with --resend-log

(imported from commit e5a7c8d5b920d796ebbf68efc2beca6b14036695)
This commit is contained in:
Keegan McAllister 2012-09-07 13:17:56 -04:00
parent 028bb9aa8d
commit 1c64ce8bfc
1 changed files with 10 additions and 9 deletions

View File

@ -53,15 +53,16 @@ if __name__ == '__main__':
for sub in subs_list:
subs.add((sub, '*', '*'))
try:
with open('zephyrs', 'r') as log:
for ln in log:
zeph = simplejson.loads(ln)
print "sending saved message to %s from %s..." % (zeph['class'], zeph['sender'])
send_zephyr(zeph)
except:
print >>sys.stderr, 'Could not load zephyr log'
traceback.print_exc()
if sys.argv[1:] == ['--resend-log']:
try:
with open('zephyrs', 'r') as log:
for ln in log:
zeph = simplejson.loads(ln)
print "sending saved message to %s from %s..." % (zeph['class'], zeph['sender'])
send_zephyr(zeph)
except:
print >>sys.stderr, 'Could not load zephyr log'
traceback.print_exc()
with open('zephyrs', 'a') as log:
print "Starting receive loop"