Skip to content

Commit

Permalink
Merge pull request #185 from tobymao/fix-raise-in-http-queue
Browse files Browse the repository at this point in the history
Fix: Raise in the HTTP queue on HTTP error
  • Loading branch information
izeigerman authored Nov 6, 2024
2 parents 6f3b7ee + faf0d16 commit 4b5ad86
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions saq/queue/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from saq.errors import MissingDependencyError
from saq.job import Job, Status
from saq.queue.base import Queue, logger
from saq.queue.base import Queue

if t.TYPE_CHECKING:
from collections.abc import Iterable
Expand Down Expand Up @@ -144,12 +144,9 @@ async def disconnect(self) -> None:
async def _send(self, kind: str, **kwargs: t.Any) -> str:
assert self.session

try:
async with self.session.post(self.url, json={"kind": kind, **kwargs}) as resp:
return await resp.text()
except Exception as e:
logger.debug(e)
return ""
async with self.session.post(self.url, json={"kind": kind, **kwargs}) as resp:
resp.raise_for_status()
return await resp.text()

async def _enqueue(self, job: Job) -> Job | None:
return self.deserialize(await self._send("enqueue", job=self.serialize(job)))
Expand Down

0 comments on commit 4b5ad86

Please sign in to comment.