Skip to content

PeriodicJob ByArgs since 0.27.0 upgrade #1087

@bertpersyn-nxh

Description

@bertpersyn-nxh

Hi!

After upgrading to 0.27.0, our tests started to fail with the following message:

expected struct, got string

Command:

type OurCommand struct {
	basecommand.CommandMetaData
	SomeBool bool
}
type CommandMetaData struct {
	UserContextName requestmetadata.UserContext `json:"userContextName"`
	OwnerOrgID      uuid.UUID                   `json:"ownerOrgID"` // references our own uuid package
	Flags           map[string]bool             `json:"flags,omitempty"`
}
---
package uuid

import (
...
	"github.com/google/uuid"
)

type UUID struct {
	uuid.UUID
}

InsertOpts

&river.InsertOpts{
			UniqueOpts: river.UniqueOpts{
				ByPeriod: 8 * 60 * time.Minute,
				ByArgs:   true,                 
			},
			Tags: []string{"periodic"},
		},

A debug session let me to this: https://github.com/riverqueue/river/pull/1076/files

internal/dbunique/unique_fields.go -> uniqueSubFields

err := getSortedUniqueFields(field.Type, path).

It was for the field ownerOrgID.

Did not debug further or try to fix it.

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions