Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pac
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tools
pac
Commits
7d66d551
Commit
7d66d551
authored
Oct 20, 2026
by
luoqi
Browse files
Options
Browse Files
Download
Plain Diff
Merge durable Meyer retry counters into test
parents
7cdccafe
e0ff1a2d
Pipeline
#3839
failed in 0 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletions
+23
-1
apps/pac-service/src/integrations/meyer/scheduler.ts
+3
-1
apps/pac-service/tests/meyer-analysis-retry.spec.ts
+20
-0
No files found.
apps/pac-service/src/integrations/meyer/scheduler.ts
View file @
7d66d551
...
...
@@ -74,7 +74,9 @@ export async function runMeyerTick(config: MeyerConfig, sourceFor: (c: MeyerConf
retryFailed
+=
result
.
failed
+
result
.
analysisFailed
;
}
catch
{
retryFailed
++
;
await
pending
.
write
(
key
,
{
...
value
,
attempts
:
value
.
attempts
+
1
,
// collector 可能已持久化请求次数后才在写运行摘要时失败;不能回写旧次数。
const
retained
=
await
pending
.
read
<
PendingImage
>
(
key
)
??
value
;
await
pending
.
write
(
key
,
{
...
retained
,
attempts
:
retained
.
attempts
+
1
,
nextRetryAt
:
new
Date
(
now
+
3600000
).
toISOString
()
});
}
}
...
...
apps/pac-service/tests/meyer-analysis-retry.spec.ts
View file @
7d66d551
...
...
@@ -115,4 +115,24 @@ describe('Meyer analysis retry policy', () => {
expect
(
s
.
source
.
symptom
).
not
.
toHaveBeenCalled
();
expect
(
s
.
sink
.
apply
).
toHaveBeenCalledTimes
(
1
);
});
test
(
'a later status-write failure cannot roll back durable analysis attempts in scheduler recovery'
,
async
()
=>
{
const
s
=
setup
();
s
.
config
.
maxAnalysisAttempts
=
1
;
await
s
.
store
.
write
(
'cursor'
,
{
through
:
chinaTime
(
created
+
2
*
3600000
)
});
await
s
.
pending
.
write
(
s
.
key
,
{
scope
:
s
.
config
.
scopes
[
0
],
image
:
meyerImage
(),
attempts
:
1
,
analysisAttempts
:
0
,
nextRetryAt
:
new
Date
(
created
).
toISOString
()
});
const
write
=
s
.
store
.
write
.
bind
(
s
.
store
);
const
spy
=
jest
.
spyOn
(
s
.
store
,
'write'
).
mockImplementation
(
async
(
key
,
value
)
=>
{
if
(
key
===
'last-run'
)
throw
Error
(
'status file unavailable'
);
return
write
(
key
,
value
);
});
const
result
=
await
runMeyerTick
(
s
.
config
,
()
=>
s
.
source
,
s
.
store
,
codes
,
s
.
sink
,
created
+
2
*
3600000
);
spy
.
mockRestore
();
expect
(
result
.
retryFailed
).
toBe
(
1
);
expect
(
await
s
.
pending
.
read
(
s
.
key
)).
toMatchObject
({
analysisAttempts
:
1
,
autoRetry
:
false
,
reason
:
'analysis_exhausted'
});
expect
(
s
.
source
.
symptom
).
toHaveBeenCalledTimes
(
1
);
await
s
.
store
.
write
(
'cursor'
,
{
through
:
chinaTime
(
created
+
4
*
3600000
)
});
const
factory
=
jest
.
fn
(()
=>
s
.
source
);
await
runMeyerTick
(
s
.
config
,
factory
,
s
.
store
,
codes
,
s
.
sink
,
created
+
4
*
3600000
);
expect
(
factory
).
not
.
toHaveBeenCalled
();
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment