Fix performance issue with handling large messages
This commit is contained in:
parent
6f9670cc65
commit
baaa0716b4
|
@ -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);
|
||||
|
|
|
@ -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({
|
||||
|
|
Loading…
Reference in New Issue
Block a user