feat(admin): 优化后台运维与任务管理
完善平台、基准模型、定价规则和实时负载的紧凑查询与滚动展示,并固定关键操作列。 新增管理员任务记录、批量计费结算和用户组限流、额度及模型权限维护能力,同时补充任务脱敏、查询索引与 OpenAPI 契约。 验证:pnpm openapi、Go 全量测试、pnpm lint、pnpm test、pnpm build、gofmt 与差异格式检查均通过。
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { retrySettlementBatch } from './BillingSettlementsPanel';
|
||||
|
||||
describe('billing settlement batch processing', () => {
|
||||
it('continues after individual failures and reports failed settlement IDs', async () => {
|
||||
const active = new Set<string>();
|
||||
let peakConcurrency = 0;
|
||||
const retryOne = vi.fn(async (item: { id: string }) => {
|
||||
active.add(item.id);
|
||||
peakConcurrency = Math.max(peakConcurrency, active.size);
|
||||
await Promise.resolve();
|
||||
active.delete(item.id);
|
||||
if (item.id === 'failed') throw new Error('retry failed');
|
||||
});
|
||||
|
||||
const result = await retrySettlementBatch(
|
||||
[{ id: 'first' }, { id: 'failed' }, { id: 'last' }],
|
||||
retryOne,
|
||||
2,
|
||||
);
|
||||
|
||||
expect(result).toEqual({ failedIds: ['failed'], succeeded: 2 });
|
||||
expect(retryOne).toHaveBeenCalledTimes(3);
|
||||
expect(peakConcurrency).toBeLessThanOrEqual(2);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user