mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
perf(core): Reuse context in runOnceForEachItem mode in task runner (#14682)
This commit is contained in:
@@ -303,10 +303,12 @@ export class JsTaskRunner extends TaskRunner {
|
|||||||
? settings.chunk.startIndex + settings.chunk.count
|
? settings.chunk.startIndex + settings.chunk.count
|
||||||
: inputItems.length;
|
: inputItems.length;
|
||||||
|
|
||||||
|
const context = this.buildContext(taskId, workflow, data.node);
|
||||||
|
|
||||||
for (let index = chunkStartIdx; index < chunkEndIdx; index++) {
|
for (let index = chunkStartIdx; index < chunkEndIdx; index++) {
|
||||||
const item = inputItems[index];
|
|
||||||
const dataProxy = this.createDataProxy(data, workflow, index);
|
const dataProxy = this.createDataProxy(data, workflow, index);
|
||||||
const context = this.buildContext(taskId, workflow, data.node, dataProxy, { item });
|
|
||||||
|
Object.assign(context, dataProxy, { item: inputItems[index] });
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let result = await new Promise<INodeExecutionData | undefined>((resolve, reject) => {
|
let result = await new Promise<INodeExecutionData | undefined>((resolve, reject) => {
|
||||||
@@ -515,7 +517,7 @@ export class JsTaskRunner extends TaskRunner {
|
|||||||
taskId: string,
|
taskId: string,
|
||||||
workflow: Workflow,
|
workflow: Workflow,
|
||||||
node: INode,
|
node: INode,
|
||||||
dataProxy: IWorkflowDataProxyData,
|
dataProxy?: IWorkflowDataProxyData,
|
||||||
additionalProperties: Record<string, unknown> = {},
|
additionalProperties: Record<string, unknown> = {},
|
||||||
): Context {
|
): Context {
|
||||||
return createContext({
|
return createContext({
|
||||||
|
|||||||
Reference in New Issue
Block a user