From c01ef2d98c3c7578d9a09dcaf7a05ff639fc1b27 Mon Sep 17 00:00:00 2001 From: latentvector Date: Wed, 20 Mar 2024 14:46:29 -0400 Subject: [PATCH] fixed server --- commune/server/server.py | 16 ++++++++-------- commune/vali/vali.py | 13 ++++++++----- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/commune/server/server.py b/commune/server/server.py index 6cf06f1a..05567a23 100644 --- a/commune/server/server.py +++ b/commune/server/server.py @@ -54,7 +54,6 @@ def __init__( name = module.__class__.__name__ self.name = name - if hasattr(module, 'schema'): self.schema = module.schema() else: @@ -65,19 +64,20 @@ def __init__( module.address = self.address self.module = module - self.set_key(key) self.access_module = c.module(access_module)(module=self.module) self.set_history_path(history_path) + self.set_key(key) + self.set_api(ip=self.ip, port=self.port) + def set_key(self, key): - self.key = key - if self.key == None: - self.key = c.get_key(self.name) - if isinstance(self.key, str): - self.key = c.get_key(self.key) - self.module.key = self.key + if key == None: + key = c.get_key(self.name) + if isinstance(key, str): + key = c.get_key(key) + self.key = self.module.key = key c.print(f'🔑 Key: {self.key} 🔑\033') diff --git a/commune/vali/vali.py b/commune/vali/vali.py index b67d0743..af9b7282 100644 --- a/commune/vali/vali.py +++ b/commune/vali/vali.py @@ -601,11 +601,14 @@ def vote_staleness(self): def vote_loop(self): while True: - r = self.vote(cache_exceptions=True) - - run_info = self.run_info() - c.print(run_info, color='cyan') - c.sleep(self.config.sleep_interval) + try: + r = self.vote(cache_exceptions=True) + c.print(r) + run_info = self.run_info() + c.print(run_info, color='cyan') + c.sleep(self.config.sleep_interval) + except Exception as e: + c.print(c.detailed_error(e)) Vali.run(__name__)