mirror of
https://framagit.org/framasoft/framaspace/argos.git
synced 2025-04-28 18:02:41 +02:00
🔀 Merge branch 'fix/reinit-http-client-on-failures' into 'main'
fix(agent): Do not reuse `http_client` on failures. Closes #37 See merge request framasoft/framaspace/argos!46
This commit is contained in:
commit
02a4d5c30b
1 changed files with 5 additions and 4 deletions
|
@ -39,15 +39,16 @@ class ArgosAgent:
|
|||
self.max_tasks = max_tasks
|
||||
self.wait_time = wait_time
|
||||
self.auth = auth
|
||||
headers = {
|
||||
"Authorization": f"Bearer {self.auth}",
|
||||
}
|
||||
self._http_client = httpx.AsyncClient(headers=headers)
|
||||
self._http_client = None
|
||||
|
||||
self.agent_id = socket.gethostname()
|
||||
|
||||
@retry(after=log_failure, wait=wait_random(min=1, max=2))
|
||||
async def run(self):
|
||||
headers = {
|
||||
"Authorization": f"Bearer {self.auth}",
|
||||
}
|
||||
self._http_client = httpx.AsyncClient(headers=headers)
|
||||
logger.info("Running agent against %s", self.server)
|
||||
async with self._http_client:
|
||||
while "forever":
|
||||
|
|
Loading…
Reference in a new issue