Merge pull request #787 from twiss/perf-fix-large-msgs

Fix performance issue with handling large messages
This commit is contained in:
Sanjana Rajan 2018-10-20 18:59:21 +02:00 committed by GitHub
commit 7a2e0dcdf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -629,7 +629,7 @@ async function convertStream(data, streaming) {
* @returns {Object} the data in the respective format
*/
async function convertStreams(obj, streaming, keys=[]) {
if (Object.prototype.isPrototypeOf(obj)) {
if (Object.prototype.isPrototypeOf(obj) && !Uint8Array.prototype.isPrototypeOf(obj)) {
await Promise.all(Object.entries(obj).map(async ([key, value]) => { // recursively search all children
if (util.isStream(value) || keys.includes(key)) {
obj[key] = await convertStream(value, streaming);

View File

@ -102,7 +102,7 @@ export default {
* @returns {Object}
*/
restoreStreams: function(obj) {
if (Object.prototype.isPrototypeOf(obj)) {
if (Object.prototype.isPrototypeOf(obj) && !Uint8Array.prototype.isPrototypeOf(obj)) {
Object.entries(obj).forEach(([key, value]) => { // recursively search all children
if (MessagePort.prototype.isPrototypeOf(value)) {
obj[key] = new ReadableStream({