mirror of
https://github.com/n8n-io/n8n.git
synced 2026-05-29 15:57:00 +02:00
fix(core): Stop idle-killing Instance AI active runs awaiting HITL (#31154)
This commit is contained in:
parent
959f8ca53c
commit
a8d29f2272
|
|
@ -17,8 +17,8 @@ describe('InstanceAiLivenessPolicy', () => {
|
|||
confirmationTimeoutMs: day,
|
||||
backgroundTaskIdleTimeoutMs: 10 * minute,
|
||||
backgroundTaskMaxLifetimeMs: 30 * minute,
|
||||
activeRunIdleTimeoutMs: 10 * minute,
|
||||
activeRunMaxLifetimeMs: 30 * minute,
|
||||
activeRunIdleTimeoutMs: 0,
|
||||
activeRunMaxLifetimeMs: day,
|
||||
});
|
||||
|
||||
expect(createInstanceAiLivenessPolicyConfig({ confirmationTimeoutMs: 42_000 })).toEqual({
|
||||
|
|
@ -58,18 +58,29 @@ describe('InstanceAiLivenessPolicy', () => {
|
|||
const decision = createPolicy().evaluate({
|
||||
surface: 'active-run',
|
||||
startedAt: 0,
|
||||
lastActivityAt: 31 * minute,
|
||||
now: 31 * minute,
|
||||
lastActivityAt: day + minute,
|
||||
now: day + minute,
|
||||
});
|
||||
|
||||
expect(decision).toMatchObject({
|
||||
action: 'timeout',
|
||||
reason: 'max_lifetime',
|
||||
surface: 'active-run',
|
||||
timeoutMs: 30 * minute,
|
||||
timeoutMs: day,
|
||||
});
|
||||
});
|
||||
|
||||
it('does not idle-timeout an active run that is waiting on another surface', () => {
|
||||
const decision = createPolicy().evaluate({
|
||||
surface: 'active-run',
|
||||
startedAt: 0,
|
||||
lastActivityAt: 0,
|
||||
now: 6 * 60 * minute,
|
||||
});
|
||||
|
||||
expect(decision).toEqual({ action: 'keep-alive' });
|
||||
});
|
||||
|
||||
it('uses the one-day confirmation timeout for suspended runs and pending confirmations by default', () => {
|
||||
const policy = createPolicy();
|
||||
const shorterWorkTimeout = 30 * minute;
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ export const INSTANCE_AI_DEFAULT_LIVENESS_POLICY_CONFIG = {
|
|||
confirmationTimeoutMs: DAY_MS,
|
||||
backgroundTaskIdleTimeoutMs: 10 * MINUTE_MS,
|
||||
backgroundTaskMaxLifetimeMs: 30 * MINUTE_MS,
|
||||
activeRunIdleTimeoutMs: 10 * MINUTE_MS,
|
||||
activeRunMaxLifetimeMs: 30 * MINUTE_MS,
|
||||
activeRunIdleTimeoutMs: 0,
|
||||
activeRunMaxLifetimeMs: DAY_MS,
|
||||
} satisfies InstanceAiLivenessPolicyConfig;
|
||||
|
||||
export function createInstanceAiLivenessPolicyConfig(
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user