Browse Source

HUE-8019 [assist] Make sure cached only catalog requests don't affect the non cached requests

The syntax checker only uses cached data and for such data catalog requests we shouldn't keep the promises around as it'll prevent subsequent requests to fail.
Johan Ahlen 8 năm trước cách đây
mục cha
commit
09d3f409a3

+ 4 - 1
desktop/core/src/desktop/static/desktop/js/dataCatalog.js

@@ -714,6 +714,10 @@ var DataCatalog = (function () {
       }
       }
       var deferred = $.Deferred();
       var deferred = $.Deferred();
 
 
+      if (options.cachedOnly && !self.sourceMeta && !self.sourceMetaPromise) {
+        return deferred.reject(false).promise();
+      }
+
       var sourceMetaPromise = self.getSourceMeta(options).done(function (sourceMeta) {
       var sourceMetaPromise = self.getSourceMeta(options).done(function (sourceMeta) {
         if (!sourceMeta || sourceMeta.notFound) {
         if (!sourceMeta || sourceMeta.notFound) {
           deferred.reject();
           deferred.reject();
@@ -1069,7 +1073,6 @@ var DataCatalog = (function () {
      * @param {string} comment
      * @param {string} comment
      * @param {Object} [apiOptions]
      * @param {Object} [apiOptions]
      * @param {boolean} [apiOptions.silenceErrors]
      * @param {boolean} [apiOptions.silenceErrors]
-     * @param {boolean} [apiOptions.cachedOnly]
      * @param {boolean} [apiOptions.refreshCache]
      * @param {boolean} [apiOptions.refreshCache]
      *
      *
      * @return {Promise}
      * @return {Promise}