wowkin2 / django-test-streaming-response

Repo to show how Django StreamingHttpResponse works with async views
5 stars 0 forks source link

test_stream.py doesn't receive anything #1

Open bblanchon opened 4 years ago

bblanchon commented 4 years ago

Hi,

When I follow the instructions on README, here is what happens:

$ python test_stream.py
2020-08-21 09:36:51,750 __main__        INFO    Started downloading content

On the server-side, however, I can see:

2020-08-21 09:36:53,777 INFO     Generated message for iteration: iteration 000000
2020-08-21 09:36:54,778 INFO     Generated message for iteration: iteration 000001

Tested with:

Best regards, Benoit

wowkin2 commented 4 years ago

@bblanchon perhaps you just need to wait until server-side will finish.

bblanchon commented 4 years ago

I waited long enough, but still nothing, and SSE is supposed to be instantaneous, right?

wowkin2 commented 4 years ago

@bblanchon Not always. SSE can be in some queue that doesn't interrupt on SIGTERM signal. Or if you manually implemented (not in this example) you can stop generator in the middle of generation.

bblanchon commented 4 years ago

From a theoretical standpoint, you may be right, but why is it not working in practice?

wowkin2 commented 4 years ago

@bblanchon hard to say what is different, need to spend time and investigate it. If you really need it - you can hire expert for money that will do it instead of you. :slightly_smiling_face: And even if it is needed - do it remotely on your environment.