File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -227,16 +227,19 @@ export default class WorkflowContext {
227227 let throttleGroup = null ;
228228
229229 if ( throttle ) {
230- const { deferSeconds } = throttle ;
230+ const { deferSeconds, group } = throttle ;
231231 if ( deferSeconds ) {
232232 const lw = await this . storage . getLastEta ( throttle ) ;
233233 if ( lw ) {
234234 return lw . id ;
235235 }
236+ eta = DateTime . now . addSeconds ( deferSeconds ) ;
237+ queued = eta ;
238+ throttleGroup = group ;
236239 } else {
237240 eta = await this . storage . getNextEta ( throttle ) ;
238241 queued = eta ;
239- throttleGroup = throttle . group ;
242+ throttleGroup = group ;
240243 }
241244 }
242245
Original file line number Diff line number Diff line change @@ -12,11 +12,18 @@ import Sql from "../sql/Sql.js";
1212
1313export type IWorkflowThrottleGroup = {
1414 group : string ;
15+ /**
16+ * Throttling based on defer, the workflow will be scheduled in future
17+ * only if current workflow in same throttle group is queued or running.
18+ */
1519 deferSeconds ?: number ;
1620 maxPerSecond ?: never ;
1721} | {
1822 group : string ;
1923 deferSeconds ?: never ;
24+ /**
25+ * Throttled on based on maximum iterations per second.
26+ */
2027 maxPerSecond ?: number ;
2128} ;
2229
You can’t perform that action at this time.
0 commit comments