Skip to content

Commit

Permalink
unnecessary asyncio lock blocks runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
hscott-yuma committed Dec 5, 2024
1 parent 121d418 commit b16f89d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions precog/validators/weight_setter.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,11 @@ async def scheduled_prediction_request(self):
except Exception as e:
bt.logging.error(f"Failed to calculate rewards with error: {e}")
# Adjust the scores based on responses from miners and update moving average.
async with self.lock:
for i, value in zip(self.available_uids, rewards):
self.moving_average_scores[i] = (1 - self.config.alpha) * self.moving_average_scores[
i
] + self.config.alpha * value
self.scores = list(self.moving_average_scores.values())
for i, value in zip(self.available_uids, rewards):
self.moving_average_scores[i] = (1 - self.config.alpha) * self.moving_average_scores[
i
] + self.config.alpha * value
self.scores = list(self.moving_average_scores.values())
if self.config.wandb_on:
log_wandb(responses, rewards, self.available_uids)
else:
Expand Down

0 comments on commit b16f89d

Please sign in to comment.