IGNITE-10076 Web Console: Use slow 'json-bigint' parser only for queries.
authorAlexey Kuznetsov <akuznetsov@apache.org>
Fri, 11 Jan 2019 10:38:55 +0000 (17:38 +0700)
committerAlexey Kuznetsov <akuznetsov@apache.org>
Fri, 11 Jan 2019 10:38:55 +0000 (17:38 +0700)
modules/web-console/frontend/app/modules/agent/AgentManager.service.js
modules/web-console/frontend/app/modules/agent/decompress.worker.js

index 0c0d9b6..faf0672 100644 (file)
@@ -487,8 +487,13 @@ export default class AgentManager {
                         if (cluster.secured)
                             this.clustersSecrets.get(cluster.id).sessionToken = res.sessionToken;
 
-                        if (res.zipped)
-                            return this.pool.postMessage(res.data);
+                        if (res.zipped) {
+                            const taskId = _.get(params, 'taskId', '');
+
+                            const useBigIntJson = taskId.startsWith('query');
+
+                            return this.pool.postMessage({payload: res.data, useBigIntJson});
+                        }
 
                         return res;
 
index 2fd294d..deffca3 100644 (file)
@@ -24,11 +24,13 @@ import bigIntJSON from 'json-bigint';
 onmessage = function(e) {
     const data = e.data;
 
-    const binaryString = atob(data); // Decode from BASE64
+    const binaryString = atob(data.payload); // Decode from BASE64
 
     const unzipped = pako.inflate(binaryString, {to: 'string'});
 
-    const res = bigIntJSON({storeAsString: true}).parse(unzipped);
+    const res = data.useBigIntJson
+        ? bigIntJSON({storeAsString: true}).parse(unzipped)
+        : JSON.parse(unzipped);
 
     postMessage(_.get(res, 'result', res));
 };