river icon indicating copy to clipboard operation
river copied to clipboard

Allow specific kinds for sequences

Open dragondgold opened this issue 1 month ago • 2 comments

We currently have the following options for sequences:

return riverpro.SequenceOpts{
	ByArgs:              true,
	ContinueOnCancelled: true,
	ContinueOnDiscarded: true,
	ByQueue:             false,
	ExcludeKind:         true,
}

By default, sequences are enforced for each job kind unless we set ExcludeKind: true, so they are enforced across all job kinds. It would be nice to have an IncludedKinds []JobArgs parameter so we can specify a list of kinds we want to include for the sequence instead of having to do everything or just one.

For example, I have the jobs user:add, user:update, user:delete, user:process jobs, but I only want one of these to be running at any given time. Right now, you would need to have a single user:operate to achieve that.

dragondgold avatar Oct 28 '25 13:10 dragondgold

Hi @dragondgold! Yes, I believe this should be possible and fairly straightforward to add. I'm thinking it would take precedence over ExcludeKind—does that sound right to you?

bgentry avatar Oct 28 '25 13:10 bgentry

Hi @dragondgold! Yes, I believe this should be possible and fairly straightforward to add. I'm thinking it would take precedence over ExcludeKind—does that sound right to you?

Indeed, taking precedence over ExcludeKind sounds good

dragondgold avatar Oct 28 '25 14:10 dragondgold