Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Fixed `JobListCursor.UnmarshalText` rejecting valid cursors whose URL-safe base64 encoding contains `-` or `_`, so cursors produced by `MarshalText` always round-trip. [PR #1388](https://github.com/riverqueue/river/pull/1388).
- Fixed SQLite job list pagination skipping or repeating jobs by formatting cursor timestamps consistently with stored timestamps. [PR #1374](https://github.com/riverqueue/river/pull/1374).
- Improved PostgreSQL job listing performance when filtering by one finalized state (`completed`, `cancelled`, or `discarded`) and sorting by finalized time, including in River UI. [PR #1374](https://github.com/riverqueue/river/pull/1374).
- Fixed `JobRescuer` overwriting jobs that complete, leave the running state, or are claimed again by another worker after being fetched for rescue, preserving their state, errors, metadata, and timestamps across PostgreSQL and SQLite drivers. Fixes [#1302](https://github.com/riverqueue/river/issues/1302). [PR #1373](https://github.com/riverqueue/river/pull/1373).
Expand Down
4 changes: 2 additions & 2 deletions job_list_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ func jobListCursorFromJobAndParams(job *rivertype.JobRow, listParams *JobListPar
// UnmarshalText implements encoding.TextUnmarshaler to decode the cursor from
// a previously marshaled string.
func (c *JobListCursor) UnmarshalText(text []byte) error {
dst := make([]byte, base64.StdEncoding.DecodedLen(len(text)))
n, err := base64.StdEncoding.Decode(dst, text)
dst := make([]byte, base64.URLEncoding.DecodedLen(len(text)))
n, err := base64.URLEncoding.Decode(dst, text)
if err != nil {
return err
}
Expand Down
19 changes: 19 additions & 0 deletions job_list_params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,25 @@ func Test_JobListCursor_MarshalJSON(t *testing.T) {
_, err := json.Marshal(cursor)
require.EqualError(t, err, "json: error calling MarshalText for type *river.JobListCursor: cursor initialized with only a job can't be marshaled; try a cursor from JobListResult instead")
})

t.Run("URLSafeAlphabet", func(t *testing.T) {
t.Parallel()

cursor := &JobListCursor{
id: 1,
kind: "a~",
queue: "default",
sortField: JobListOrderByID,
}

text, err := cursor.MarshalText()
require.NoError(t, err)
require.Contains(t, string(text), "-")

decoded := &JobListCursor{}
require.NoError(t, decoded.UnmarshalText(text))
require.Equal(t, cursor, decoded)
})
}

func Test_JobListParams_toDBParams(t *testing.T) {
Expand Down
Loading