Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
bf7b79f2
Commit
bf7b79f2
authored
Jan 18, 2026
by
yangjianbo
Browse files
fix(数据库): 优化任务状态更新查询,使用别名提高可读性
parent
8391d480
Changes
1
Show whitespace changes
Inline
Side-by-side
backend/internal/repository/usage_cleanup_repo.go
View file @
bf7b79f2
...
@@ -136,16 +136,16 @@ func (r *usageCleanupRepository) ClaimNextPendingTask(ctx context.Context, stale
...
@@ -136,16 +136,16 @@ func (r *usageCleanupRepository) ClaimNextPendingTask(ctx context.Context, stale
LIMIT 1
LIMIT 1
FOR UPDATE SKIP LOCKED
FOR UPDATE SKIP LOCKED
)
)
UPDATE usage_cleanup_tasks
UPDATE usage_cleanup_tasks
AS tasks
SET status = $4,
SET status = $4,
started_at = NOW(),
started_at = NOW(),
finished_at = NULL,
finished_at = NULL,
error_message = NULL,
error_message = NULL,
updated_at = NOW()
updated_at = NOW()
FROM next
FROM next
WHERE
usage_cleanup_
tasks.id = next.id
WHERE tasks.id = next.id
RETURNING
id,
status, filters, created_by, deleted_rows, error_message,
RETURNING
tasks.id, tasks.
status,
tasks.
filters,
tasks.
created_by,
tasks.
deleted_rows,
tasks.
error_message,
started_at, finished_at, created_at, updated_at
tasks.
started_at,
tasks.
finished_at,
tasks.
created_at,
tasks.
updated_at
`
`
var
task
service
.
UsageCleanupTask
var
task
service
.
UsageCleanupTask
var
filtersJSON
[]
byte
var
filtersJSON
[]
byte
...
...
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