Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cursor.toArray() hanging on complex query #27

Closed
chrisvariety opened this issue Jun 25, 2014 · 2 comments
Closed

cursor.toArray() hanging on complex query #27

chrisvariety opened this issue Jun 25, 2014 · 2 comments

Comments

@chrisvariety
Copy link

Sorry for the barrage today.

This query works in the data explorer, but hangs on yield cursor.toArray(); within rethinkdbdash.

r.db('ti_development').table('courses').getAll('cde178e3-4c82-4918-b022-9042c3ace84c', {index: 'company'}).map(function(course) {
  return r.object(
    'course', course,
    'sections', r.branch(course('sections').count().eq(0), [], r.db('ti_development').table('sections').getAll(r.args(course('sections'))).coerceTo('ARRAY'))
  ).merge(function(hash) {
    return r.object('lessons', hash('sections').concatMap(function(section) { return section('lessons'); }).do(function(lessons) {
      return r.branch(lessons.count().eq(0), [], r.db('ti_development').table('lessons').getAll(r.args(lessons)).coerceTo('ARRAY'));
    }));
  }).merge(function(hash) {
    return r.object('topics', hash('lessons').concatMap(function(lesson) { return lesson('topics')('id'); }).do(function(topics) {
      return r.branch(topics.count().eq(0), [], r.db('ti_development').table('topics').getAll(r.args(topics)).coerceTo('ARRAY'));
    }));
  });
});

Full query wrapped in co: https://gist.github.com/chrisvariety/68a13224fc15922217d9

Any thoughts? Specifically it's the last .merge() that causes the hang -- removing that makes rethinkdbdash hang-free. And specifically it's directly related to the data, as different ids do not hang with the exact same query.

Happy to email the data set to you (it is very tiny) so you can reproduce, just let me know your email...

Thanks!!

@neumino
Copy link
Owner

neumino commented Jun 25, 2014

I just pushed a new package 1.13.1.

The empty response SUCCESS_COMPLETE was not properly handled. It should work fine now.
If it doesn't, let me know.

@chrisvariety
Copy link
Author

Thanks so much! Working great now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants