Skip to content

Commit

Permalink
feat: small changes after self peer review
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel1302 committed Jul 29, 2023
1 parent 1de5fa9 commit ca5be5d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vega_sim/api/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ def wait_for_datanode_sync(
*at the time of call* not necessarily the latest data when the function returns.
Wait time is exponential with increasing retries
(each attempt waits 0.0005 * 1.01^attempt_num seconds).
(each attempt waits 0.05 * 1.03^attempt_num seconds).
"""
attempts = 1
core_time = retry(10, 0.5, lambda: core_data_client.GetVegaTime(GetVegaTimeRequest()).timestamp)
trading_time = retry(10, 0.5, lambda: trading_data_client.GetVegaTime(GetVegaTimeRequest()).timestamp)
while core_time > trading_time:
logging.info(f"Sleeping in wait_for_datanode_sync for {0.05 * 1.03**attempts}")
logging.debug(f"Sleeping in wait_for_datanode_sync for {0.05 * 1.03**attempts}")
time.sleep(0.05 * 1.03**attempts)
try:
trading_time = retry(10, 2.0, lambda: trading_data_client.GetVegaTime(GetVegaTimeRequest()).timestamp)
Expand Down Expand Up @@ -103,10 +103,10 @@ def wait_for_core_catchup(
core_time_two = retry(10, 0.5, lambda: core_data_client.GetVegaTime(GetVegaTimeRequest()).timestamp)

while core_time != core_time_two:
logging.info(f"Sleeping in wait_for_core_catchup for {0.05 * 1.03**attempts}")
logging.debug(f"Sleeping in wait_for_core_catchup for {0.05 * 1.03**attempts}")

core_time = retry(10, 0.5, lambda: core_data_client.GetVegaTime(GetVegaTimeRequest()).timestamp)
time.sleep(0.05 * 1.1**attempts)
time.sleep(0.05 * 1.03**attempts)
core_time_two = retry(10, 0.5, lambda: core_data_client.GetVegaTime(GetVegaTimeRequest()).timestamp)
attempts += 1
if attempts >= max_retries:
Expand Down

0 comments on commit ca5be5d

Please sign in to comment.