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_r142932754
##########
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 {
+ return new FauxtonAPI.Promise((resolve) => {
Review comment:
You can use
[Promise.resolve](http://bluebirdjs.com/docs/api/promise.resolve.html) instead
----------------------------------------------------------------
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