cofin / litestar-saq

SAQ Plugin for Litestar
MIT License
18 stars 8 forks source link

SAQ Web #39

Open PanagiotisS opened 3 hours ago

PanagiotisS commented 3 hours ago

Hello,

at the current state the web ui web_enabled=True, is not functioning (or at least the same as saq).

There are two issues.

  1. The http://127.0.0.1:8000/saq/queues/default does not show the jobs. In order to do so we need to do the following change,

https://github.com/cofin/litestar-saq/blob/main/litestar_saq/controllers.py#L68

-          return {"queue": await queue.info()}
+          return {"queue": await queue.info(jobs=True)}

The respective code in saq is https://github.com/tobymao/saq/blob/f7c5d9d9f4772b9db741a7507a2843e1134dd5a7/saq/web/starlette.py#L67

  1. The job info api does not work.

https://github.com/cofin/litestar-saq/blob/main/litestar_saq/controllers.py#L18

-    job = await queue._get_job_by_id(job_id)  # noqa: SLF001
+    job = await queue.job(job_id)  # noqa: SLF001

The respective code in saq is https://github.com/tobymao/saq/blob/f7c5d9d9f4772b9db741a7507a2843e1134dd5a7/saq/web/starlette.py#L109

Thank you and best wishes

P.S. There is also the issue that http://127.0.0.1:8000/saq does not work and needs to be http://127.0.0.1:8000/saq/ or in opposite manner http://127.0.0.1:8000/saq/queues/default works but http://127.0.0.1:8000/saq/queues/default/ does not, but that's upstream issue with the way routes regex is constructed.