Skip to content

Commit a95fc3a

Browse files
author
acer-king
committed
version upgrade
1 parent 33ab9df commit a95fc3a

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

miner/miner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def run(self):
125125
f"on network: {self.subtensor.chain_endpoint} "
126126
f"with netuid: {self.config.netuid}"
127127
)
128-
# self.axon.serve(self.config.netuid, subtensor=self.subtensor)
128+
self.axon.serve(self.config.netuid, subtensor=self.subtensor)
129129
bt.logging.info(f"Starting axon server on port: {self.config.axon.port}")
130130
self.axon.start()
131131
self.last_epoch_block = self.subtensor.get_current_block()

validators/utils.py

+9-12
Original file line numberDiff line numberDiff line change
@@ -187,20 +187,18 @@ def get_bandwidth(data, uid, provider, model):
187187
def load_entire_questions():
188188
# Asynchronous function to fetch a URL
189189
async def fetch(session, url):
190-
async with session.get(url) as response:
191-
try:
190+
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=60)) as session:
191+
async with session.get(url) as response:
192192
return await response.json()
193-
except Exception as err:
194-
pass
195193

196194
# Asynchronous function to gather multiple HTTP requests
197195
async def gather_requests(urls):
198-
async with aiohttp.ClientSession() as session:
199-
tasks = []
200-
for url in urls:
201-
tasks.append(fetch(session, url)) # Create a task for each URL
202-
results = await asyncio.gather(*tasks) # Run all tasks concurrently
203-
return results
196+
# async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=30)) as session:
197+
tasks = []
198+
for url in urls:
199+
tasks.append(fetch(None, url))
200+
results = await asyncio.gather(*tasks, return_exceptions=True) # Run all tasks concurrently
201+
return results
204202

205203
# Main function to run the event loop
206204
def main(urls):
@@ -215,12 +213,11 @@ def main(urls):
215213
responses = main(urls)
216214
queries = []
217215
for response in responses:
218-
if response is None:
216+
if response is None or isinstance(response, Exception):
219217
continue
220218
for row in response.get('rows', []):
221219
query = row['row']['query']
222220
queries.append(query)
223-
224221
return queries
225222

226223

0 commit comments

Comments
 (0)