mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor(core): Provide clearer errors on task runner rejection (#14666)
This commit is contained in:
@@ -258,17 +258,20 @@ export abstract class TaskRunner extends EventEmitter {
|
|||||||
request.resolve(nodeTypes);
|
request.resolve(nodeTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
hasOpenTasks() {
|
/**
|
||||||
|
* Whether the task runner has capacity to accept more tasks.
|
||||||
|
*/
|
||||||
|
hasOpenTaskSlots() {
|
||||||
return this.runningTasks.size < this.maxConcurrency;
|
return this.runningTasks.size < this.maxConcurrency;
|
||||||
}
|
}
|
||||||
|
|
||||||
offerAccepted(offerId: string, taskId: string) {
|
offerAccepted(offerId: string, taskId: string) {
|
||||||
if (!this.hasOpenTasks()) {
|
if (!this.hasOpenTaskSlots()) {
|
||||||
this.openOffers.delete(offerId);
|
this.openOffers.delete(offerId);
|
||||||
this.send({
|
this.send({
|
||||||
type: 'runner:taskrejected',
|
type: 'runner:taskrejected',
|
||||||
taskId,
|
taskId,
|
||||||
reason: 'No open task slots',
|
reason: 'No open task slots - runner already at capacity',
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -278,7 +281,7 @@ export abstract class TaskRunner extends EventEmitter {
|
|||||||
this.send({
|
this.send({
|
||||||
type: 'runner:taskrejected',
|
type: 'runner:taskrejected',
|
||||||
taskId,
|
taskId,
|
||||||
reason: 'Offer expired and no open task slots',
|
reason: 'Offer expired - not accepted within validity window',
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user