Explorar el Código

HUE-9005 [editor] Fix issue with cancelling statement execution in notebook 2

Johan Ahlen hace 6 años
padre
commit
7b64997a58

+ 10 - 3
desktop/core/src/desktop/js/api/apiHelper.js

@@ -2100,8 +2100,11 @@ class ApiHelper {
           if (options.executable.handle !== handle) {
             options.executable.handle = handle;
           }
-          this.cancelStatement(options);
-        } catch (err) {}
+          await this.cancelStatement(options);
+        } catch (err) {
+          console.warn('Failed cancelling statement');
+          console.warn(err);
+        }
       }
     });
 
@@ -2239,7 +2242,11 @@ class ApiHelper {
    */
   async cancelStatement(options) {
     return new Promise(async (resolve, reject) => {
-      this.simplePost('/notebook/api/cancel_statement', options.executable.toContext(), options)
+      this.simplePost(
+        '/notebook/api/cancel_statement',
+        await options.executable.toContext(),
+        options
+      )
         .done(resolve)
         .fail(reject);
     });

+ 4 - 0
desktop/core/src/desktop/js/apps/notebook2/execution/executable.js

@@ -269,6 +269,10 @@ export default class Executable {
               statusCheckCount > 45 ? 5000 : 1000
             );
             break;
+          case EXECUTION_STATUS.failed:
+            this.executeEnded = Date.now();
+            this.setStatus(queryStatus);
+            break;
           default:
             this.executeEnded = Date.now();
             console.warn('Got unknown status ' + queryStatus);