Skip to content

Commit

Permalink
fix: don't skip locked on updating worker
Browse files Browse the repository at this point in the history
  • Loading branch information
abelanger5 committed Aug 6, 2024
1 parent 6b3f402 commit 45b1869
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
11 changes: 1 addition & 10 deletions pkg/repository/prisma/dbsqlc/workers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,13 @@ INSERT INTO "Worker" (
) RETURNING *;

-- name: UpdateWorkerHeartbeat :one
WITH to_update AS (
SELECT
"id"
FROM
"Worker"
WHERE
"id" = @id::uuid
FOR UPDATE SKIP LOCKED
)
UPDATE
"Worker"
SET
"updatedAt" = CURRENT_TIMESTAMP,
"lastHeartbeatAt" = sqlc.narg('lastHeartbeatAt')::timestamp
WHERE
"id" IN (SELECT "id" FROM to_update)
"id" = @id::uuid
RETURNING *;

-- name: UpdateWorker :one
Expand Down
11 changes: 1 addition & 10 deletions pkg/repository/prisma/dbsqlc/workers.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 45b1869

Please sign in to comment.