fix(core & function nodes): Update function nodes to work with binary-data-mode 'filesystem'. (#3845)

* Initial Fix

* Self-Review #1

* Lint

* Added support for FunctionItem. Minor updates.

* Self-review

* review comments. Added testing.

* Self Review

* Fixed memory handling on data manager use.

* Fixes for unnecessary memory leaks.
This commit is contained in:
Rhys Williams
2022-09-11 16:42:09 +02:00
committed by GitHub
parent b450e977a3
commit f6064ef278
7 changed files with 267 additions and 4 deletions

View File

@@ -50,15 +50,23 @@ export class BinaryDataManager {
): Promise<IBinaryData> {
const retBinaryData = binaryData;
// If a manager handles this binary, return the binary data with it's reference id.
if (this.managers[this.binaryDataMode]) {
return this.managers[this.binaryDataMode]
.storeBinaryData(binaryBuffer, executionId)
.then((filename) => {
// Add data manager reference id.
retBinaryData.id = this.generateBinaryId(filename);
// Prevent preserving data in memory if handled by a data manager.
retBinaryData.data = this.binaryDataMode;
// Short-circuit return to prevent further actions.
return retBinaryData;
});
}
// Else fallback to storing this data in memory.
retBinaryData.data = binaryBuffer.toString(BINARY_ENCODING);
return binaryData;
}