From c4a5a93c294d7a12a6a8439248df6d8d89f9f1cc Mon Sep 17 00:00:00 2001 From: Juan Villegas Date: Mon, 13 Apr 2020 11:03:16 -0600 Subject: [PATCH] Update factory.js Attempt to address https://github.com/strongloop/loopback-component-storage/issues/289. Looking forward to comments. --- lib/factory.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/factory.js b/lib/factory.js index 01b70d5..1021ddb 100644 --- a/lib/factory.js +++ b/lib/factory.js @@ -37,7 +37,11 @@ function patchBaseClass(cls) { client: {value: this.client}, files: {value: this.files}, }); - m1.call(receiver, details); + // The following line appears to be calling _setProperties recursively, eventually eating up all the memory and killing the + // server. If not commented out, this._metadata = receiver creates a reference to an object that contains exactly the same + // data, which itself contains another reference and so on. The response we get from the api is thus in the order of MBs. + // We noted removing the m1.call line works as expected, however we are unsure what side effects this may have. + // m1.call(receiver, details); // Apply the calculated properties to this for (var p in receiver) { this[p] = receiver[p];