From e4ecc5688ab0d074d74b89a046bfcb160a0db6a8 Mon Sep 17 00:00:00 2001 From: Jean Demeusy Date: Wed, 22 Nov 2023 20:04:12 +0100 Subject: [PATCH] Update sleep duration and fix broker URL --- ct-app/core/core.py | 8 +++----- ct-app/core/model/economic_model.py | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/ct-app/core/core.py b/ct-app/core/core.py index 33dd6246..46032dc6 100644 --- a/ct-app/core/core.py +++ b/ct-app/core/core.py @@ -233,7 +233,7 @@ async def apply_economic_model(self): self.debug(f"Network size: {len(peers)}") ready = len(topology) and len(subgraph) and len(peers) - await asyncio.sleep(1) + await asyncio.sleep(2) eligibles = Utils.mergeTopologyPeersSubgraph(topology, peers, subgraph) self.debug(f"Merged topology and subgraph data ({len(eligibles)} entries).") @@ -280,10 +280,8 @@ async def distribute_rewards(self): ) delay = Utils.nextDelayInSeconds(model.delay_between_distributions) - self.debug(f"Relay delay would be {delay} seconds.") - delay = 20 - self.debug(f"Waiting {delay} seconds for next distribution.") + await asyncio.sleep(delay) min_peers = self.params.distribution.min_eligible_peers @@ -307,7 +305,7 @@ async def distribute_rewards(self): # create celery tasks app = Celery( name=self.params.rabbitmq.project_name, - broker=f"amqp://{self.params.rabbitmq.username}:{self.params.rabbitmq.password}@{self.params.rabbitmq.host}/", + broker=f"amqp://{self.params.rabbitmq.username}:{self.params.rabbitmq.password}@{self.params.rabbitmq.host}/{self.params.rabbitmq.virtualhost}", ) app.autodiscover_tasks(force=True) diff --git a/ct-app/core/model/economic_model.py b/ct-app/core/model/economic_model.py index 9d0703c7..8e1437e4 100644 --- a/ct-app/core/model/economic_model.py +++ b/ct-app/core/model/economic_model.py @@ -163,9 +163,9 @@ def delay_between_distributions(self): @classmethod def fromDict(cls, _input: dict): - equations = Equations.from_dictionary(_input.get("equations", {})) - parameters = Parameters.from_dictionary(_input.get("parameters", {})) - budget = BudgetParameters.from_dictionary(_input.get("budget_param", {})) + equations = Equations.from_dictionary(_input.get("equations")) + parameters = Parameters.from_dictionary(_input.get("parameters")) + budget = BudgetParameters.from_dictionary(_input.get("budget_param")) return cls(equations, parameters, budget)