[Feature Request] Support Deadline parameter for batch job gathering in riverbatch.WorkerOpts
#1266
janblaha-arenko
started this conversation in
Ideas
Replies: 1 comment
-
|
This seems to make sense — and would mirror the @bgentry Can you comment on this one before I try do to anything? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
TLDR:
I have a scenario where I need a batch of jobs to be worked no later than
x(which is dynamic). The currentMaxDelay(time.Duration) parameter makes this slightly awkward as we need to calculate theMaxDelaybased on a diff withtime.Now. I believe a more ergonomic way of implementing such logic would be for River to support aDeadline(time.Time) parameter with basically the existing logic.Details:
Currently, the Batching feature in RiverPro supports a
MaxDelayargument which represents the "maximum amount of time to wait for a full batch withMaxCountjobs to be available" (documentation).It is currently possible to implement a sort of "deadline" in the worker
Workfunction which callsriverbatch.Workwithriverbatch.WorkerOpts. In the work function it is possible to compute something like the following:However, I believe it would be beneficial if the
WorkerOptssupported this directly with a newDeadlineoption. The two (MaxDelayandDeadline) could be made exclusive or falling back to one or the other when both are present. In terms of implementation I believe it should be fairly simple - just a ticker in a newcasestatement.Beta Was this translation helpful? Give feedback.
All reactions