We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c9a915f commit 436a3aeCopy full SHA for 436a3ae
1 file changed
tutorial.md
@@ -934,13 +934,15 @@ def ajax_endpoint(environ, start_response):
934
('Content-Type', 'application/json')
935
]
936
937
- try:
938
- datum = data_source.get(timeout=5)
939
- except Empty:
940
- datum = []
941
-
942
start_response(status, headers)
943
- return json.dumps(datum)
+
+ while True:
+ try:
+ datum = data_source.get(timeout=5)
+ yield json.dumps(datum) + '\n'
+ except Empty:
944
+ pass
945
946
947
gevent.spawn(producer)
948
0 commit comments