Skip to content

Commit

Permalink
Replace job calls in queue with self calls (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
vchan authored Sep 16, 2024
1 parent 0ed1042 commit 89de1e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion saq/queue/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ async def sweep(self, lock: int = 60, abort: float = 5.0) -> list[str]:
if job.retryable:
await self.retry(job, error="swept")
else:
await job.finish(Status.ABORTED, error="swept")
await self.finish(job, Status.ABORTED, error="swept")
return swept

async def listen(
Expand Down
4 changes: 2 additions & 2 deletions saq/queue/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ async def sweep(self, lock: int = 60, abort: float = 5.0) -> list[str]:
if job.retryable:
await self.retry(job, error="swept")
else:
await job.finish(Status.ABORTED, error="swept")
await self.finish(job, Status.ABORTED, error="swept")
else:
swept.append(job_id)

Expand Down Expand Up @@ -332,7 +332,7 @@ async def abort(self, job: Job, error: str, ttl: float = 5) -> None:
)

if dequeued:
await job.finish(Status.ABORTED, error=error)
await self.finish(job, Status.ABORTED, error=error)
await self.redis.delete(job.abort_id)
else:
await self.redis.lrem(self._active, 0, job.id)
Expand Down

0 comments on commit 89de1e2

Please sign in to comment.