-
Notifications
You must be signed in to change notification settings - Fork 1
fix(pipeline): resilient cursor save + SQLite cursor lock + gateway retry + scheduled autoretry [修复组④] #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
backend/migrations/versions/t9y0z1a2b3c4_add_source_cursor_version.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| """add version column to source_cursors (optimistic-concurrency cursor save) | ||
|
|
||
| Revision ID: t9y0z1a2b3c4 | ||
| Revises: s8x9y0z1a2b3 | ||
|
|
||
| AUDIT C10: ``DBCursorStore.save()`` used ``SELECT ... FOR UPDATE`` to guard | ||
| against two concurrent runs of the same source losing an update, but that | ||
| clause is a silent no-op on SQLite (the dialect accepts it but never takes a | ||
| row lock) — so the lost-update protection only ever existed on a Postgres | ||
| deployment. This adds an integer ``version`` column so ``save()`` can use | ||
| optimistic concurrency (``UPDATE ... WHERE version = ?``) instead, which | ||
| works identically on SQLite and Postgres. | ||
| """ | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
|
|
||
| revision = "t9y0z1a2b3c4" | ||
| down_revision = "s8x9y0z1a2b3" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| with op.batch_alter_table("source_cursors") as batch: | ||
| batch.add_column( | ||
| sa.Column("version", sa.Integer(), nullable=False, server_default="0") | ||
| ) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| with op.batch_alter_table("source_cursors") as batch: | ||
| batch.drop_column("version") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在
backend/pipeline/error_taxonomy.py中,您已将408(Request Timeout) 归类为可重试的 HTTP 状态码(is_retryable_http_status)。然而,在backend/pipeline/http_client.py的RETRY_STATUS集合中,并没有包含408。这会导致RateLimitedClient在遇到408时不会在 HTTP 客户端级别进行轻量级重试,而是直接抛出异常并触发重量级的 Celery 任务级重试。建议将408补充到RETRY_STATUS中,以保持一致性并提高重试效率。