AlexNijjar commited on
Commit
c656c20
·
1 Parent(s): 8cdce17

Reconnect substrate on error

Browse files
Files changed (1) hide show
  1. src/chain_data.py +2 -0
src/chain_data.py CHANGED
@@ -174,6 +174,7 @@ last_commitment_sync: datetime = datetime.fromtimestamp(0, TIMEZONE)
174
 
175
 
176
  def sync_metagraph(timeout: int = 10):
 
177
  global last_sync
178
  now = datetime.now(TIMEZONE)
179
  if now - last_sync < timedelta(minutes=5):
@@ -212,3 +213,4 @@ def sync_metagraph(timeout: int = 10):
212
  print("Timed out while syncing metagraph")
213
  except Exception as e:
214
  print(f"Error occurred while syncing metagraph: {e}")
 
 
174
 
175
 
176
  def sync_metagraph(timeout: int = 10):
177
+ global substrate
178
  global last_sync
179
  now = datetime.now(TIMEZONE)
180
  if now - last_sync < timedelta(minutes=5):
 
213
  print("Timed out while syncing metagraph")
214
  except Exception as e:
215
  print(f"Error occurred while syncing metagraph: {e}")
216
+ substrate = get_substrate()