feat(shipping-notice): 完善处理投影与待办轮询
- 统一处理阶段、Gate 状态及跨页面投影 - 优化订单提取自动推进与待办分类查询 - 完善任务中心待办与批次轮询逻辑 - 补充后端投影、Gate、查询及 Worker 测试 - 新增待办轮询设计文档并更新技术文档
This commit is contained in:
1 parent
9d2fa522fa
commit
fbca0b485c
22 files changed
+1454
-225
No files matched your search
@@ -6,7 +6,7 @@
|
||||
* 逻辑:选中项展示入口卡 + 五阶段筛选 + 统一进度紧凑摘要;主按钮深链「订单生命周期工作台」;
|
||||
* review_case 在 failed/manual_fallback 时提供「重试自动推进」(与底栏同一 API/幂等键);
|
||||
* 不内嵌 ShippingTaskWorkbench;生命周期筛选、禁用与深链只消费后端
|
||||
* ui_state.lifecycle_entries,Intake parse_status 仅用于解析任务轮询。
|
||||
* ui_state.lifecycle_entries;轮询只跟系统 running,silent 刷新不闪加载。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
@@ -31,38 +31,24 @@ import {
|
||||
import { useShippingTodoBadge } from '../composables/useShippingTodoBadge';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import {
|
||||
IN_PROGRESS_PROCESSING_STATUSES,
|
||||
TERMINAL_PROCESSING_STATUSES,
|
||||
} from '@/features/chat/shipping/shippingProcessingFulfillment';
|
||||
import { resolveGateReasonLabel } from '@/features/shipping-progress/gateReasonLabel';
|
||||
import {
|
||||
isShippingTodoListItemInProgress,
|
||||
resolveTodoCenterPollIntervalMs,
|
||||
} from './shippingTaskCenterPolling';
|
||||
import ShippingRunProgressTable from './ShippingRunProgressTable.vue';
|
||||
import { downloadWorkspaceShippingNoticeExportArchive } from '@/features/chat/shipping/shippingDownload';
|
||||
|
||||
const { t, te } = useI18n();
|
||||
const msg = useMessage();
|
||||
/** 进行中 Workflow/Task 前台轮询间隔。 */
|
||||
const FOREGROUND_POLL_MS = 2000;
|
||||
/** 页面隐藏时后台轮询间隔。 */
|
||||
const BACKGROUND_POLL_MS = 8000;
|
||||
|
||||
/**
|
||||
* 判断详情是否仍处于进行中。
|
||||
* 核心逻辑:优先统一 ui_state.stage;技术 processing status 仅用于轮询,不用于业务阶段展示。
|
||||
* 判断详情是否仍处于系统处理中。
|
||||
* 核心逻辑:与列表项同一 running 谓词;阶段码不得单独维持轮询。
|
||||
*/
|
||||
function isDetailInProgress(task: ShippingTaskDetail | null): boolean {
|
||||
if (!task) return false;
|
||||
const stage = String(task.ui_state?.stage?.code || '').trim();
|
||||
if (stage) return stage !== 'upload_complete';
|
||||
const unified = String(task.shipping_processing_status || '').trim().toLowerCase();
|
||||
if (unified) {
|
||||
if (TERMINAL_PROCESSING_STATUSES.has(unified)) return false;
|
||||
return IN_PROGRESS_PROCESSING_STATUSES.has(unified);
|
||||
}
|
||||
return false;
|
||||
return isShippingTodoListItemInProgress(task);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,6 +105,9 @@ const bucketCounts = ref<ShippingMyTodosCount>({
|
||||
const chatAgentId = ref<number | null>(null);
|
||||
let pollTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
let pollInFlight = false;
|
||||
let pollFailureCount = 0;
|
||||
let processingPollStartedAt: number | null = null;
|
||||
let lastForegroundPullAt = 0;
|
||||
|
||||
const totalPages = computed(() => Math.max(1, Math.ceil(totalTasks.value / pageSize)));
|
||||
const preferredTaskNo = computed(() =>
|
||||
@@ -345,23 +334,41 @@ async function runNoticeBatchAction(action: 'download' | 'confirm' | 'rpa'): Pro
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否应继续自动轮询:processing 桶、进行中直链详情,或 runs 面;列表项按统一投影。
|
||||
* 当前页是否存在系统正在自动跑的项。
|
||||
*/
|
||||
const shouldAutoRefresh = computed(() => {
|
||||
if (surface.value === 'runs') return true;
|
||||
if (bucket.value === 'processing') return true;
|
||||
const hasRunningWork = computed(() => {
|
||||
if (isDirectTaskRoute.value && isDetailInProgress(detail.value)) return true;
|
||||
return tasks.value.some((item) => isListItemInProgress(item));
|
||||
});
|
||||
|
||||
/**
|
||||
* 按页面可见性选择轮询间隔。
|
||||
* 当前页是否仅为人工等待(用于 30s 低频轮询;已完成桶不轮询)。
|
||||
*/
|
||||
function resolvePollMs(): number {
|
||||
if (typeof document !== 'undefined' && document.visibilityState === 'hidden') {
|
||||
return BACKGROUND_POLL_MS;
|
||||
}
|
||||
return FOREGROUND_POLL_MS;
|
||||
const hasHumanWaitWork = computed(() => {
|
||||
if (hasRunningWork.value) return false;
|
||||
if (surface.value !== 'todos') return false;
|
||||
if (bucket.value === 'done') return false;
|
||||
return tasks.value.length > 0;
|
||||
});
|
||||
|
||||
/**
|
||||
* 是否应继续自动轮询:系统在跑或当前页仍有人工待办。
|
||||
*/
|
||||
const shouldAutoRefresh = computed(() => hasRunningWork.value || hasHumanWaitWork.value);
|
||||
|
||||
/**
|
||||
* 解析待办轮询间隔:running 复用批次函数;人工等待 30s。
|
||||
*/
|
||||
function resolvePollMs(): number | null {
|
||||
const visibility = typeof document !== 'undefined' ? document.visibilityState : 'visible';
|
||||
const elapsedMs = processingPollStartedAt != null ? Date.now() - processingPollStartedAt : 0;
|
||||
return resolveTodoCenterPollIntervalMs({
|
||||
hasRunning: hasRunningWork.value,
|
||||
hasHumanWait: hasHumanWaitWork.value,
|
||||
elapsedMs,
|
||||
visibility,
|
||||
failureCount: pollFailureCount,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -375,26 +382,32 @@ function stopAutoRefresh() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 调度下一次自动刷新(仅进行中项)。
|
||||
* 调度下一次自动刷新(仅系统在跑或人工等待低频)。
|
||||
*/
|
||||
function scheduleAutoRefresh() {
|
||||
stopAutoRefresh();
|
||||
if (!shouldAutoRefresh.value) return;
|
||||
const intervalMs = resolvePollMs();
|
||||
if (intervalMs == null) return;
|
||||
pollTimer = setTimeout(() => {
|
||||
void (async () => {
|
||||
if (pollInFlight || !shouldAutoRefresh.value) {
|
||||
if (pollInFlight) {
|
||||
scheduleAutoRefresh();
|
||||
return;
|
||||
}
|
||||
const nextInterval = resolvePollMs();
|
||||
if (nextInterval == null) return;
|
||||
pollInFlight = true;
|
||||
try {
|
||||
await refreshAll({ silent: true });
|
||||
pollFailureCount = 0;
|
||||
} catch {
|
||||
pollFailureCount += 1;
|
||||
} finally {
|
||||
pollInFlight = false;
|
||||
scheduleAutoRefresh();
|
||||
}
|
||||
})();
|
||||
}, resolvePollMs());
|
||||
}, intervalMs);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -450,10 +463,12 @@ function resetFilters() {
|
||||
/**
|
||||
* 拉取当前桶待办列表。
|
||||
* @param resetPage - 切换桶时重置到第一页
|
||||
* @param options.silent - 为 true 时不切换 loading,保留旧列表(轮询失败也不清空)
|
||||
*/
|
||||
async function loadTodos(resetPage = false) {
|
||||
async function loadTodos(resetPage = false, options?: { silent?: boolean }) {
|
||||
if (resetPage) currentPage.value = 1;
|
||||
loading.value = true;
|
||||
const silent = Boolean(options?.silent);
|
||||
if (!silent) loading.value = true;
|
||||
try {
|
||||
const category = appliedFilters.value.todo_category || undefined;
|
||||
const result = await listWorkspaceShippingMyTodos({
|
||||
@@ -475,34 +490,37 @@ async function loadTodos(resetPage = false) {
|
||||
if (hit) selectedRef.value = todoItemKey(hit);
|
||||
}
|
||||
} catch {
|
||||
tasks.value = [];
|
||||
totalTasks.value = 0;
|
||||
if (!silent) {
|
||||
tasks.value = [];
|
||||
totalTasks.value = 0;
|
||||
}
|
||||
} finally {
|
||||
loading.value = false;
|
||||
if (!silent) loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 直链场景拉取任务摘要(仅入口卡,不挂工作台)。
|
||||
*/
|
||||
async function loadDetail(taskNo: string) {
|
||||
detailLoading.value = true;
|
||||
async function loadDetail(taskNo: string, options?: { silent?: boolean }) {
|
||||
const silent = Boolean(options?.silent);
|
||||
if (!silent) detailLoading.value = true;
|
||||
try {
|
||||
detail.value = await getWorkspaceShippingTask(taskNo);
|
||||
} catch {
|
||||
detail.value = null;
|
||||
if (!silent) detail.value = null;
|
||||
} finally {
|
||||
detailLoading.value = false;
|
||||
if (!silent) detailLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表与(可选)直链摘要联动刷新。
|
||||
*/
|
||||
async function refreshAll(_options?: { silent?: boolean }) {
|
||||
await Promise.all([loadTodos(), loadCounts()]);
|
||||
async function refreshAll(options?: { silent?: boolean }) {
|
||||
await Promise.all([loadTodos(false, options), loadCounts()]);
|
||||
if (isDirectTaskRoute.value && preferredTaskNo.value) {
|
||||
await loadDetail(preferredTaskNo.value);
|
||||
await loadDetail(preferredTaskNo.value, options);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -675,17 +693,46 @@ watch(selectedItem, (item) => {
|
||||
detail.value = null;
|
||||
});
|
||||
|
||||
watch(hasRunningWork, (running) => {
|
||||
if (running) {
|
||||
processingPollStartedAt = processingPollStartedAt ?? Date.now();
|
||||
} else {
|
||||
processingPollStartedAt = null;
|
||||
}
|
||||
});
|
||||
|
||||
watch(shouldAutoRefresh, () => {
|
||||
scheduleAutoRefresh();
|
||||
});
|
||||
|
||||
/**
|
||||
* 页面可见性变化时重排轮询间隔。
|
||||
* 回到前台时立刻静默拉一次,再按当前间隔重排。
|
||||
*/
|
||||
function pullOnForeground() {
|
||||
const now = Date.now();
|
||||
if (now - lastForegroundPullAt < 1000) {
|
||||
scheduleAutoRefresh();
|
||||
return;
|
||||
}
|
||||
lastForegroundPullAt = now;
|
||||
void refreshAll({ silent: true }).finally(() => scheduleAutoRefresh());
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面可见性变化时:可见则立刻刷新,隐藏则只拉长间隔。
|
||||
*/
|
||||
function onVisibilityChange() {
|
||||
if (typeof document !== 'undefined' && document.visibilityState === 'visible') {
|
||||
pullOnForeground();
|
||||
return;
|
||||
}
|
||||
scheduleAutoRefresh();
|
||||
}
|
||||
|
||||
function onWindowFocus() {
|
||||
pullOnForeground();
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await Promise.all([resolveChatAgent(), loadCounts(), loadTodos()]);
|
||||
if (preferredTaskNo.value) {
|
||||
@@ -703,12 +750,14 @@ onMounted(async () => {
|
||||
}
|
||||
}
|
||||
document.addEventListener('visibilitychange', onVisibilityChange);
|
||||
window.addEventListener('focus', onWindowFocus);
|
||||
scheduleAutoRefresh();
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
stopAutoRefresh();
|
||||
document.removeEventListener('visibilitychange', onVisibilityChange);
|
||||
window.removeEventListener('focus', onWindowFocus);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
+76
-3
@@ -1,11 +1,15 @@
|
||||
/**
|
||||
* features/workspace/shipping-task-center/shippingTaskCenterPolling.spec.ts
|
||||
* 用途:锁定任务中心自动轮询的边界,避免人工待处理任务被误判为持续处理中。
|
||||
* 依赖:isShippingTodoListItemInProgress。
|
||||
* 逻辑:只有后端明确的进行中状态继续轮询;复核草稿、失败和完成任务停止轮询。
|
||||
* 依赖:isShippingTodoListItemInProgress、resolveTodoCenterPollIntervalMs。
|
||||
* 逻辑:只有系统 running 继续高频轮询;复核草稿、失败和完成停止;人工等待 30s。
|
||||
*/
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { isShippingTodoListItemInProgress } from './shippingTaskCenterPolling';
|
||||
import {
|
||||
HUMAN_WAIT_POLL_MS,
|
||||
isShippingTodoListItemInProgress,
|
||||
resolveTodoCenterPollIntervalMs,
|
||||
} from './shippingTaskCenterPolling';
|
||||
|
||||
describe('isShippingTodoListItemInProgress', () => {
|
||||
it('does not poll a review case that is waiting for human editing', () => {
|
||||
@@ -17,6 +21,32 @@ describe('isShippingTodoListItemInProgress', () => {
|
||||
} as never)).toBe(false);
|
||||
});
|
||||
|
||||
it('does not poll waiting_review or needs_action as system running', () => {
|
||||
expect(isShippingTodoListItemInProgress({
|
||||
item_kind: 'task',
|
||||
task_no: 'OT-1',
|
||||
shipping_processing_status: 'waiting_review',
|
||||
} as never)).toBe(false);
|
||||
expect(isShippingTodoListItemInProgress({
|
||||
item_kind: 'task',
|
||||
task_no: 'OT-2',
|
||||
shipping_processing_status: 'needs_action',
|
||||
} as never)).toBe(false);
|
||||
expect(isShippingTodoListItemInProgress({
|
||||
item_kind: 'task',
|
||||
task_no: 'OT-3',
|
||||
shipping_processing_status: 'blocked',
|
||||
} as never)).toBe(false);
|
||||
});
|
||||
|
||||
it('does not treat a non-complete lifecycle stage as running', () => {
|
||||
expect(isShippingTodoListItemInProgress({
|
||||
item_kind: 'task',
|
||||
task_no: 'OT-STAGE',
|
||||
ui_state: { stage: { code: 'order_review', label: '订单复核', index: 1, total: 5 } },
|
||||
} as never)).toBe(false);
|
||||
});
|
||||
|
||||
it('continues polling a review case with an explicit processing status', () => {
|
||||
expect(isShippingTodoListItemInProgress({
|
||||
item_kind: 'review_case',
|
||||
@@ -26,4 +56,47 @@ describe('isShippingTodoListItemInProgress', () => {
|
||||
review_run_no: 'RUN-1',
|
||||
} as never)).toBe(true);
|
||||
});
|
||||
|
||||
it('continues polling queued automating or running execution', () => {
|
||||
expect(isShippingTodoListItemInProgress({
|
||||
item_kind: 'task',
|
||||
task_no: 'OT-Q',
|
||||
shipping_processing_status: 'queued',
|
||||
} as never)).toBe(true);
|
||||
expect(isShippingTodoListItemInProgress({
|
||||
item_kind: 'task',
|
||||
task_no: 'OT-A',
|
||||
shipping_processing_status: 'automating',
|
||||
} as never)).toBe(true);
|
||||
expect(isShippingTodoListItemInProgress({
|
||||
item_kind: 'task',
|
||||
task_no: 'OT-E',
|
||||
ui_state: { process_gate: { status: 'active' } },
|
||||
} as never)).toBe(true);
|
||||
expect(isShippingTodoListItemInProgress({
|
||||
item_kind: 'task',
|
||||
task_no: 'OT-U',
|
||||
user_status: 'running',
|
||||
} as never)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('resolveTodoCenterPollIntervalMs', () => {
|
||||
it('reuses batch intervals while system work is running', () => {
|
||||
expect(resolveTodoCenterPollIntervalMs({
|
||||
hasRunning: true, hasHumanWait: false, elapsedMs: 0, visibility: 'visible', failureCount: 0,
|
||||
})).toBe(2000);
|
||||
expect(resolveTodoCenterPollIntervalMs({
|
||||
hasRunning: true, hasHumanWait: false, elapsedMs: 15000, visibility: 'visible', failureCount: 0,
|
||||
})).toBe(5000);
|
||||
});
|
||||
|
||||
it('uses 30s for human wait and stops when idle', () => {
|
||||
expect(resolveTodoCenterPollIntervalMs({
|
||||
hasRunning: false, hasHumanWait: true, elapsedMs: 0, visibility: 'visible', failureCount: 0,
|
||||
})).toBe(HUMAN_WAIT_POLL_MS);
|
||||
expect(resolveTodoCenterPollIntervalMs({
|
||||
hasRunning: false, hasHumanWait: false, elapsedMs: 0, visibility: 'visible', failureCount: 0,
|
||||
})).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -1,18 +1,20 @@
|
||||
/**
|
||||
* features/workspace/shipping-task-center/shippingTaskCenterPolling.ts
|
||||
* 用途:任务中心列表项是否仍需前台轮询(纯函数,供页面与单测共用)。
|
||||
* 依赖:ShippingTaskSummary、shippingProcessingFulfillment 状态集合。
|
||||
* 逻辑:ShippingTaskCenterPage 用本函数决定 poll;Intake created/queued/parsing 必须轮询,
|
||||
* parse_failed 停止;review_case 持续轮询;OT/Notice 走统一投影状态。
|
||||
* 用途:任务中心列表项是否系统在跑、以及待办页轮询间隔(纯函数)。
|
||||
* 依赖:ShippingTaskSummary、useShippingNoticeWorkflow 间隔函数。
|
||||
* 逻辑:ShippingTaskCenterPage 用本模块决定 poll;仅 queued/processing/automating/running
|
||||
* 或 Execution active/waiting_external 算系统在跑;人工等待走 30s;间隔复用批次函数。
|
||||
*/
|
||||
|
||||
import type { ShippingTaskSummary } from '@/features/chat/api/shipping.api';
|
||||
import {
|
||||
IN_PROGRESS_PROCESSING_STATUSES,
|
||||
TERMINAL_PROCESSING_STATUSES,
|
||||
} from '@/features/chat/shipping/shippingProcessingFulfillment';
|
||||
resolveProcessingPollBackoffMs,
|
||||
resolveProcessingPollIntervalMs,
|
||||
type ProcessingPollContext,
|
||||
} from '@/features/chat/shipping/useShippingNoticeWorkflow';
|
||||
import { TERMINAL_PROCESSING_STATUSES } from '@/features/chat/shipping/shippingProcessingFulfillment';
|
||||
|
||||
/** 历史轮询状态集合;正常任务中心优先消费统一 ui_state。 */
|
||||
/** 历史轮询状态集合;正常任务中心不再用它判定系统处理中。 */
|
||||
export const IN_PROGRESS_PROCESS = new Set([
|
||||
'parsing',
|
||||
'parsed',
|
||||
@@ -26,41 +28,78 @@ export const IN_PROGRESS_PROCESS = new Set([
|
||||
'pending_void',
|
||||
]);
|
||||
|
||||
/** Intake 仍在解析、必须轮询的状态。 */
|
||||
/** Intake 仍在解析、必须高频轮询的状态。 */
|
||||
export const INTAKE_POLLING_PARSE_STATUSES = new Set([
|
||||
'created',
|
||||
'queued',
|
||||
'parsing',
|
||||
]);
|
||||
|
||||
/** 系统正在自动跑的统一 processing status;不含人工等待。 */
|
||||
export const SYSTEM_RUNNING_PROCESSING_STATUSES = new Set([
|
||||
'queued',
|
||||
'processing',
|
||||
'automating',
|
||||
'running',
|
||||
]);
|
||||
|
||||
/** Execution.status 中表示系统仍在推进。 */
|
||||
const RUNNING_EXECUTION_STATUSES = new Set([
|
||||
'active',
|
||||
'waiting_external',
|
||||
]);
|
||||
|
||||
/** 仅人工等待时的待办轮询间隔,与批次中心后台档一致。 */
|
||||
export const HUMAN_WAIT_POLL_MS = 30000;
|
||||
|
||||
/**
|
||||
* 判断列表项是否应触发轮询刷新。
|
||||
* 核心逻辑:review_case 持续轮询;order_intake 仅 created/queued/parsing;
|
||||
* 其余优先 shipping_processing_status,再按统一 ui_state.stage;
|
||||
* 不复用 WorkflowItem lifecycle。
|
||||
* 判断列表项是否仍有系统在自动跑,从而需要高频轮询。
|
||||
* 核心逻辑:Intake created/queued/parsing;其余只认 running 投影
|
||||
* (shipping_processing_status / user_status / Execution active),
|
||||
* 不把 waiting_review / needs_action / blocked / 阶段码当成处理中。
|
||||
* @param item - 我的待办列表项
|
||||
* @returns 是否需要继续轮询
|
||||
* @returns 是否系统处理中
|
||||
*/
|
||||
export function isShippingTodoListItemInProgress(item: ShippingTaskSummary): boolean {
|
||||
if (item.item_kind === 'review_case' || (item.review_run_no && !item.task_no)) {
|
||||
const unified = String(item.shipping_processing_status || '').trim().toLowerCase();
|
||||
if (unified) {
|
||||
if (TERMINAL_PROCESSING_STATUSES.has(unified)) return false;
|
||||
return IN_PROGRESS_PROCESSING_STATUSES.has(unified);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (item.item_kind === 'order_intake') {
|
||||
const intakeStatus = String(
|
||||
item.intake_parse_status || '',
|
||||
).trim().toLowerCase();
|
||||
if (item.item_kind === 'order_intake' || (item.intake_no && !item.task_no && !item.review_run_no)) {
|
||||
const intakeStatus = String(item.intake_parse_status || '').trim().toLowerCase();
|
||||
return INTAKE_POLLING_PARSE_STATUSES.has(intakeStatus);
|
||||
}
|
||||
const unified = String(item.shipping_processing_status || '').trim().toLowerCase();
|
||||
if (unified) {
|
||||
if (TERMINAL_PROCESSING_STATUSES.has(unified)) return false;
|
||||
return IN_PROGRESS_PROCESSING_STATUSES.has(unified);
|
||||
return SYSTEM_RUNNING_PROCESSING_STATUSES.has(unified);
|
||||
}
|
||||
const stage = String(item.ui_state?.stage?.code || '').trim();
|
||||
return Boolean(stage) && stage !== 'upload_complete';
|
||||
const userStatus = String(
|
||||
(item as { user_status?: string | null }).user_status
|
||||
|| (item.ui_state as { user_status?: string; status?: string } | undefined)?.user_status
|
||||
|| (item.ui_state as { status?: string } | undefined)?.status
|
||||
|| '',
|
||||
).trim().toLowerCase();
|
||||
if (userStatus === 'running') return true;
|
||||
const executionStatus = String(item.ui_state?.process_gate?.status || '').trim().toLowerCase();
|
||||
return RUNNING_EXECUTION_STATUSES.has(executionStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 待办页轮询间隔:系统在跑复用批次函数;仅人工等待 30s;否则停。
|
||||
*/
|
||||
export function resolveTodoCenterPollIntervalMs(context: {
|
||||
hasRunning: boolean;
|
||||
hasHumanWait: boolean;
|
||||
elapsedMs: number;
|
||||
visibility: ProcessingPollContext['visibility'];
|
||||
failureCount: number;
|
||||
}): number | null {
|
||||
if (context.hasRunning) {
|
||||
return resolveProcessingPollIntervalMs({
|
||||
elapsedMs: context.elapsedMs,
|
||||
visibility: context.visibility,
|
||||
hasProcessing: true,
|
||||
failureCount: context.failureCount,
|
||||
});
|
||||
}
|
||||
if (!context.hasHumanWait) return null;
|
||||
if (context.failureCount > 0) return resolveProcessingPollBackoffMs(context.failureCount);
|
||||
return HUMAN_WAIT_POLL_MS;
|
||||
}
|
||||
Reference in new issue
Block a user