You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote about this problem earlier and decided that all right, but I have it again.
I have gevent and rethinkdb in django project. I try use changefeed in code bellow but It not works.
class ProjectsNamespace(BaseAuthNamespace):
def DB_listener(self):
feed = r.table('projects').changes().run()
for change in feed:
self.logger.debug('changefeed event')
def recv_connect(self):
self.spawn(self.DB_listener)
There are no any actions or error message. If i add gevent.sleep(0) in for body It works, but application hangs after page reload.
I tried use monkey_patch, Timeouts from gevent, native python thread and python rethinkdb driver from next but It did not help.
When I tried python driver from next somtimes I get error like it:
File "/usr/local/lib/python2.7/site-packages/rethinkdb/ast.py", line 438, in filter
return Filter(self, *[func_wrap(arg) for arg in args], **kwargs)
File "/usr/local/lib/python2.7/site-packages/rethinkdb/ast.py", line 1803, in func_wrap
if _ivar_scan(val):
File "/usr/local/lib/python2.7/site-packages/rethinkdb/ast.py", line 1793, in _ivar_scan
if any([_ivar_scan(arg) for arg in query.args]):
AttributeError: 'MakeObj' object has no attribute 'args'
Hi @nickmishustin, we fixed the second bug yesterday in next with dd28b11 . You might want to try the latest commit.
I'm not familiar with gevent myself. @Tryneus could you take a look at @nickmishustin example above please?
If gevent works similar to Tornado, you might have to write something like this instead of the for loop:
classProjectsNamespace(BaseAuthNamespace):
defDB_listener(self):
feed=yieldr.table('projects').changes().run()
while (yieldfeed.fetch_next()):
change=yieldfeed.next()
self.logger.debug('changefeed event')
defrecv_connect(self):
self.spawn(self.DB_listener)
@nickmishustin - I do not know the details of your spawn method, or how you're using gevent in your application, so it's hard for me to tell what's causing the problem. If it helps, here is a small script that works fine for me for the same use case:
You shouldn't need to monkey-patch anything (although it shouldn't break anything, either), as the rethinkdb driver will use gevent.socket directly rather than the base socket implementation.
Activity
danielmewes commentedon Feb 12, 2016
Hi @nickmishustin, we fixed the second bug yesterday in
nextwith dd28b11 . You might want to try the latest commit.I'm not familiar with gevent myself. @Tryneus could you take a look at @nickmishustin example above please?
If gevent works similar to Tornado, you might have to write something like this instead of the for loop:
Tryneus commentedon Feb 13, 2016
@nickmishustin - I do not know the details of your
spawnmethod, or how you're using gevent in your application, so it's hard for me to tell what's causing the problem. If it helps, here is a small script that works fine for me for the same use case:You shouldn't need to monkey-patch anything (although it shouldn't break anything, either), as the rethinkdb driver will use
gevent.socketdirectly rather than the base socket implementation.nickmishustin commentedon Feb 15, 2016
@danielmewes, thanks,
dd28b11fixed error above.@Tryneus, thanks, it works!
danielmewes commentedon Feb 15, 2016
Closing since it's now working.
Reminded me that we need to document the gevent integration though: rethinkdb/docs#1019