Flask and RQ Example for Heroku
I have been struggling to find any example on the Internet on how to do long polling on Heroku with Flask and RQ. I know it’s relatively easy, but I just want to make it clear for my future self.
It’s really simple.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
The key is here
The fetch command is used to get the job by job_id, you can also use
as well, but I just want to make it clear that if there are more concurrent requests coming in, I’ll get the right result back.
I posted an example here. https://github.com/noppanit/heroku-flask-rq-worker