From d7236ba8efc980d1234d9adcb0f1a7792e176d26 Mon Sep 17 00:00:00 2001 From: Douglas Muraoka Date: Sat, 28 Dec 2019 02:13:07 -0300 Subject: [PATCH] fix(GraphQL): Timeout when fetching huge collections (#6304) * fix(GraphQL): Timeout when fetching huge collections Currently, when not specifying a `limit` to the GraphQL find-like query, it tries to fetch the entire collection of objects from a class. However, if the class contains a huge set of objects, it is never resolved and results in timeout. In order to solve this kind of problem, `parse-server` allows us to define a `maxLimit` parameter when initialized, which limits the maximum number of objects fetched per query; but it is not properly considered when the `limit` is undefined. * fix: Keep same behavior as REST fetch --- src/GraphQL/helpers/objectsQueries.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/GraphQL/helpers/objectsQueries.js b/src/GraphQL/helpers/objectsQueries.js index 6b7a184d..3e918c98 100644 --- a/src/GraphQL/helpers/objectsQueries.js +++ b/src/GraphQL/helpers/objectsQueries.js @@ -119,6 +119,8 @@ const findObjects = async ( ) { if (limit || limit === 0) { options.limit = limit; + } else { + options.limit = 100; } if (options.limit !== 0) { if (order) {