Skip to content

Commit

Permalink
Increase graphs timeouts, small refactoring (#106)
Browse files Browse the repository at this point in the history
Signed-off-by: cyc60 <[email protected]>

Signed-off-by: cyc60 <[email protected]>
  • Loading branch information
cyc60 authored Aug 22, 2022
1 parent 025af94 commit 736deb7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions oracle/oracle/common/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
logger = logging.getLogger(__name__)


# set default GQL query execution timeout to 30 seconds
EXECUTE_TIMEOUT = 30
# set default GQL query execution timeout to 45 seconds
EXECUTE_TIMEOUT = 45

# set default GQL pagination
PAGINATION_WINDOWS = 1000
Expand Down
11 changes: 4 additions & 7 deletions oracle/oracle/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,13 @@ async def process_network(
current_timestamp = finalized_block["timestamp"]

latest_block_number = await get_latest_block_number(NETWORK)

while not (await has_synced_block(NETWORK, latest_block_number)):
graphs_synced = await has_synced_block(NETWORK, latest_block_number)
if not graphs_synced:
continue

voting_parameters = await get_voting_parameters(
NETWORK, current_block_number
)
# there is no consensus
if not voting_parameters:
return

await asyncio.gather(
# check and update staking rewards
Expand All @@ -143,8 +140,8 @@ async def process_network(
)
except BaseException as e:
logger.exception(e)

await asyncio.sleep(ORACLE_PROCESS_INTERVAL)
finally:
await asyncio.sleep(ORACLE_PROCESS_INTERVAL)


if __name__ == "__main__":
Expand Down

0 comments on commit 736deb7

Please sign in to comment.