fix: ensure worker queue advances on error
This commit is contained in:
@@ -23,6 +23,7 @@ type Querier interface {
|
||||
GetUserWatchList(ctx context.Context, userID string) ([]GetUserWatchListRow, error)
|
||||
GetWatchListEntry(ctx context.Context, arg GetWatchListEntryParams) (WatchListEntry, error)
|
||||
GetWatchingAnime(ctx context.Context, userID string) ([]GetWatchingAnimeRow, error)
|
||||
MarkRelationsSynced(ctx context.Context, id int64) error
|
||||
UpdateAnimeStatus(ctx context.Context, arg UpdateAnimeStatusParams) error
|
||||
UpsertAnime(ctx context.Context, arg UpsertAnimeParams) (Anime, error)
|
||||
UpsertAnimeRelation(ctx context.Context, arg UpsertAnimeRelationParams) error
|
||||
|
||||
@@ -86,7 +86,10 @@ ON CONFLICT (anime_id, related_anime_id) DO UPDATE SET
|
||||
relation_type = excluded.relation_type;
|
||||
|
||||
-- name: UpdateAnimeStatus :exec
|
||||
UPDATE anime SET status = ?, relations_synced_at = CURRENT_TIMESTAMP WHERE id = ?;
|
||||
UPDATE anime SET status = ? WHERE id = ?;
|
||||
|
||||
-- name: MarkRelationsSynced :exec
|
||||
UPDATE anime SET relations_synced_at = CURRENT_TIMESTAMP WHERE id = ?;
|
||||
|
||||
-- name: GetAnimeNeedingRelationSync :many
|
||||
WITH RECURSIVE sequel_chain AS (
|
||||
|
||||
@@ -459,8 +459,17 @@ func (q *Queries) GetWatchingAnime(ctx context.Context, userID string) ([]GetWat
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const markRelationsSynced = `-- name: MarkRelationsSynced :exec
|
||||
UPDATE anime SET relations_synced_at = CURRENT_TIMESTAMP WHERE id = ?
|
||||
`
|
||||
|
||||
func (q *Queries) MarkRelationsSynced(ctx context.Context, id int64) error {
|
||||
_, err := q.db.ExecContext(ctx, markRelationsSynced, id)
|
||||
return err
|
||||
}
|
||||
|
||||
const updateAnimeStatus = `-- name: UpdateAnimeStatus :exec
|
||||
UPDATE anime SET status = ?, relations_synced_at = CURRENT_TIMESTAMP WHERE id = ?
|
||||
UPDATE anime SET status = ? WHERE id = ?
|
||||
`
|
||||
|
||||
type UpdateAnimeStatusParams struct {
|
||||
|
||||
Reference in New Issue
Block a user