Skip to content

The ScheduledAt insert option doesn't work from JobArgsWithInsertOpts #484

Description

@dbhoot

According to the docs, the worker args should be able to provide default insert options by implementing the InsertOps function. This includes the ScheduledAt attribute. The comments/docs indicate the scheduled at is normally meant to be provided explicitly, however it should work both ways (because docs say it will work).

        // ScheduledAt is a time in future at which to schedule the job (i.e. in
	// cases where it shouldn't be run immediately). The job is guaranteed not
	// to run before this time, but may run slightly after depending on the
	// number of other scheduled jobs and how busy the queue is.
	//
	// Use of this option generally only makes sense when passing options into
	// Insert rather than when a job args struct is implementing
	// JobArgsWithInsertOpts, however, it will work in both cases.
	ScheduledAt time.Time

However, my reading of client.go (see link) shows that the scheduled at insert options is only respected when passed explicitly on insert. The ScheduledAt field is ignored when coming from InsertOps function on the args being inserted.

https://github.com/riverqueue/river/blob/v0.10.1/client.go#L1212

My work-around is to call InsertOpts() on the args explicitly and pass a reference on every insert

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions