Skip to content

Commit

Permalink
Fix duplicated log issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel committed May 3, 2022
1 parent 43b4eca commit 1d5728f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions jmclient/jmclient/wallet_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def __init__(self, port, wss_port, tls=True):
# Doubles as flag for indicating whether we're currently running
# a tumble schedule.
self.tumbler_options = None
self.tumble_log = None

def get_client_factory(self):
return JMClientProtocolFactory(self.taker)
Expand Down Expand Up @@ -438,11 +439,12 @@ def taker_finished(self, res, fromtx=False, waittime=0.0, txdetails=None):
self.stop_taker(res)
else:
# We're running the tumbler.
assert self.tumble_log is not None

logsdir = os.path.join(os.path.dirname(jm_single().config_location), "logs")
tumble_log = get_tumble_log(logsdir)
sfile = os.path.join(logsdir, self.tumbler_options['schedulefile'])

tumbler_taker_finished_update(self.taker, sfile, tumble_log, self.tumbler_options, res, fromtx, waittime, txdetails)
tumbler_taker_finished_update(self.taker, sfile, self.tumble_log, self.tumbler_options, res, fromtx, waittime, txdetails)

if not fromtx:
# The tumbling schedule's final transaction is done.
Expand Down Expand Up @@ -1099,10 +1101,12 @@ def dummy_user_callback(rel, abs):
with open(sfile, "wb") as f:
f.write(schedule_to_text(schedule))

tumble_log = get_tumble_log(logsdir)
tumble_log.info("TUMBLE STARTING")
tumble_log.info("With this schedule: ")
tumble_log.info(pprint.pformat(schedule))
if self.tumble_log is None:
self.tumble_log = get_tumble_log(logsdir)

self.tumble_log.info("TUMBLE STARTING")
self.tumble_log.info("With this schedule: ")
self.tumble_log.info(pprint.pformat(schedule))

# -- Running the Taker ---------------------------------------------

Expand Down

0 comments on commit 1d5728f

Please sign in to comment.