Skip to content
Merged
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 @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Sleep durations are now logged as Go-like duration strings (e.g. "10s") in either text or JSON instead of duration strings in text and nanoseconds in JSON. [PR #699](https://github.com/riverqueue/river/pull/699).
- Altered the migration comments from `river migrate-get` to include the "line" of the migration being run (`main`, or for River Pro `workflow` and `sequence`) to make them more distinguishable. [PR #703](https://github.com/riverqueue/river/pull/703).
- Fewer slice allocations during unique insertions. [PR #705](https://github.com/riverqueue/river/pull/705).

### Fixed

Expand Down
15 changes: 8 additions & 7 deletions insert_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ func (o *UniqueOpts) isEmpty() bool {

var jobStateAll = rivertype.JobStates() //nolint:gochecknoglobals

var requiredV3states = []rivertype.JobState{ //nolint:gochecknoglobals
rivertype.JobStateAvailable,
rivertype.JobStatePending,
rivertype.JobStateRunning,
rivertype.JobStateScheduled,
}

func (o *UniqueOpts) validate() error {
if o.isEmpty() {
return nil
Expand All @@ -209,13 +216,7 @@ func (o *UniqueOpts) validate() error {
return nil
}

requiredV3states := []rivertype.JobState{
rivertype.JobStateAvailable,
rivertype.JobStatePending,
rivertype.JobStateRunning,
rivertype.JobStateScheduled,
}
missingStates := []string{}
var missingStates []string
for _, state := range requiredV3states {
if !slices.Contains(o.ByState, state) {
missingStates = append(missingStates, string(state))
Expand Down