mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
sse: gotta use a special version of zeromq (zmq.green) when in gevent context
This commit is contained in:
parent
ad345ee1bf
commit
af2316233a
1 changed files with 6 additions and 5 deletions
|
@ -352,7 +352,7 @@ class _ActionsMapPlugin:
|
||||||
|
|
||||||
def sse(self):
|
def sse(self):
|
||||||
import time
|
import time
|
||||||
import zmq
|
import zmq.green as zmq
|
||||||
|
|
||||||
# FIXME : check auth...
|
# FIXME : check auth...
|
||||||
|
|
||||||
|
@ -367,13 +367,14 @@ class _ActionsMapPlugin:
|
||||||
# Set client-side auto-reconnect timeout, ms.
|
# Set client-side auto-reconnect timeout, ms.
|
||||||
yield 'retry: 100\n\n'
|
yield 'retry: 100\n\n'
|
||||||
|
|
||||||
while True:
|
|
||||||
try:
|
try:
|
||||||
|
while True:
|
||||||
if sub.poll(10, zmq.POLLIN):
|
if sub.poll(10, zmq.POLLIN):
|
||||||
_, msg = sub.recv_multipart()
|
_, msg = sub.recv_multipart()
|
||||||
yield 'data: ' + str(msg.decode()) + '\n\n'
|
yield 'data: ' + str(msg.decode()) + '\n\n'
|
||||||
except KeyboardInterrupt:
|
finally:
|
||||||
break
|
sub.close()
|
||||||
|
ctx.term()
|
||||||
|
|
||||||
def process(self, _route, arguments={}):
|
def process(self, _route, arguments={}):
|
||||||
"""Process the relevant action for the route
|
"""Process the relevant action for the route
|
||||||
|
|
Loading…
Add table
Reference in a new issue