-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Add support for maxTimeMS mongoOption #3018
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
Add support for maxTimeMS mongoOption #3018
Conversation
@@ -60,6 +60,39 @@ describe_only_db('mongo')('MongoStorageAdapter', () => { | |||
}); | |||
}); | |||
|
|||
fit('find succeeds when query is within maxTimeMS', (done) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no fit there buddy :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, already fixed :-( and I fixed the tests failing on mongodb 3.0.x
bb0e9ca
to
19bf63c
Compare
@TylerBrock updated the pull request - view changes |
|
||
// MaxTimeMS is not a global MongoDB client option, it is applied per operation. | ||
this._maxTimeMS = mongoOptions.maxTimeMS; | ||
delete mongoOptions.maxTimeMS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this delete the property from the options being passed in? Not sure if we clone before passing in - perhaps we should shallow clone here if not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just going to remove the delete altogether, it will be ignored by the driver.
19bf63c
to
366c72f
Compare
@TylerBrock updated the pull request - view changes |
.then(() => adapter._rawFind('Foo', { '$where': `sleep(${maxTimeMS * 2})` })) | ||
.then( | ||
() => { | ||
done('Find succeeded despite taking too long!'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just spotted this - should we instead call fail('reason')
and then done()
? Looks like currently the test won't fail when the operation succeeds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So should be
fail('Find succeeded despite taking too long!');
done();
366c72f
to
d1cee52
Compare
@TylerBrock updated the pull request - view changes |
We have several enormous collections (think 35 million+ objects). When running parse-dashboard there is no way to prevent users from finding/sorting on criteria having no index. The dashboard doesn't respond, users click to sort the other direction, more slow running queries... eventually the system comes down.
Eventually it would be nice to have parse-dashboard only allow sorting/filtering on indexed columns and on all columns when the collection size is less than 10k objects or something. Even then, there is no guarantee our application's inbound queries are all covered. For example a user in the browser JS console making their own queries.
It would be nice to put a limit on find/count (in MS) by taking advantage of the per-operation $maxTimeMS MongoDB query operator. This is an initial stab at getting it to work.