Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

214
Views
Why are all requests sent after an event-stream request stuck in pending?

I have a Flask app that sends an event stream of temperature data to the client. Since the application controls a kiln, it's important that the user can access the job specific controls (Stop, Pause, Resume, etc).

Right now, the chart updates with information coming from the event source, but when I try to change routes to control the kiln itself, the request is stuck in "Pending".

Any advice?

Relevant code:

commands.py

def generate_data(self):
  ...
  while True:
    time.sleep(1)
    temp_data = json.loads(data)
    temp = temp_data['temp']
    json_data = json.dumps({'time': datetime.now(), 'temp': temp})
    yield f"data:{json_data}\n\n"

views.py

...
@app.route('/chart_data')
def chart_data():
  kc = kiln_command.KilnCommand()
  return Response(kc.generate_data(), mimetype='text/event-stream')

show_jobs.html

...
<script>
...
const context = document.getElementById('canvas').getContext('2d')

const lineChart = new Chart(context, config)

const source = new EventSource("/chart_data")

source.onmessage = function (event) {
  const data = JSON.parse(event.data);
  ...
</script>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!