Skip to content

Commit

Permalink
Fix task runner
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbruinsslot committed Jan 15, 2025
1 parent 3f0f3eb commit e772838
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion boefjes/boefjes/clients/scheduler_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ def pop_item(self, scheduler_id: str) -> Task | None:
self._verify_response(response)

page = TypeAdapter(PaginatedTasksResponse | None).validate_json(response.content)
return TypeAdapter(Task | None).validate_json(page.results[0]) if page else None
if page.count == 0:
return None

return page.results[0]

def pop_items(self, scheduler_id: str, filters: dict[str, Any]) -> PaginatedTasksResponse | None:
response = self._session.post(f"/schedulers/{scheduler_id}/pop", json=filters)
Expand Down

0 comments on commit e772838

Please sign in to comment.