Closed activestylus closed 7 years ago
Probably multiple ways to do this, but in the past, I've used a Job model with a progress attribute. I then create a Job and pass the Job ID when queueing, which gets fetched inside the worker and updated as necessary.
Requires repetitive lookups on the client side to fetch the progress, but perhaps you could pair it with Postgres's pub/sub (if you're using it), to be notified when to refetch and send the SSE event.
Not far off from my actual solution. I managed to solve this problem with websockets and a loop on the server which updates a model with the job's progress. Works a treat
Is there a way to provide feedback of a job's progress?
I was hoping that when jobs get started I could track their progress every few seconds, then use SSE to push them to the UI level.
Any ideas?