Skip to content

Commit 217112d

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 8ac4d93 + 653c168 commit 217112d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tutorial.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,13 +1090,15 @@ def ajax_endpoint(environ, start_response):
10901090
('Content-Type', 'application/json')
10911091
]
10921092

1093-
try:
1094-
datum = data_source.get(timeout=5)
1095-
except Empty:
1096-
datum = []
1097-
10981093
start_response(status, headers)
1099-
return json.dumps(datum)
1094+
1095+
while True:
1096+
try:
1097+
datum = data_source.get(timeout=5)
1098+
yield json.dumps(datum) + '\n'
1099+
except Empty:
1100+
pass
1101+
11001102

11011103
gevent.spawn(producer)
11021104

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy