garrensmith commented on a change in pull request #993: Display Mango execution 
statistics, when available
URL: https://github.com/apache/couchdb-fauxton/pull/993#discussion_r142931614
 
 

 ##########
 File path: app/addons/documents/mango/mango.api.js
 ##########
 @@ -84,6 +84,30 @@ export const fetchIndexes = (databaseName, params) => {
     });
 };
 
+// assume all databases being accessed are on the same
+// host / CouchDB version
+let supportsExecutionStatsCache = null;
+const supportsExecutionStats = (databaseName) => {
+  if (supportsExecutionStatsCache === null) {
+    return new FauxtonAPI.Promise((resolve) => {
+      mangoQuery(databaseName, {
+        selector: {
+          "_id": {"$gt": "a" }
+       },
+        execution_stats: true
+      }, {limit: 1})
+      .then(resp => {
+        supportsExecutionStatsCache = resp.status == 200;
+        resolve(supportsExecutionStatsCache);
+      });
+    });
+  } else {
 
 Review comment:
   You don'e need an else since you are returning in the if.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to