pvillard31 commented on PR #11945:
URL: https://github.com/apache/nifi/pull/11945#issuecomment-7129972444

   > As part of this changeset I also wanted to avoid having to recompute the 
milliseconds value used on L593 but I didn't want to introduce another 
parameter and I couldn't quite figure out the reasoning behind using the 
`timeUnit` as the number of bins in the `timedBuffer`.
   > 
   > Is someone able to shed some light on that?
   
   I'm probably not the best person to answer as I don't have the whole history 
on that component however... my understanding is that the time unit is not the 
number of bins. In `TimedBuffer(final TimeUnit binPrecision, final int numBins, 
...)`, the first argument is the size of one bin, and the second argument is 
how many bins there are. Throttle passes `TimeUnit.SECONDS` and `timePeriod`. 
So a 60 second period gives 60 bins of one second each (the buffer adds one 
extra bin internally). Each FlowFile goes into the bin for the current second, 
and `getAggregateValue` adds up the bins inside the window.
   
   This is why Throttle needs both values. The unit and count build the bins, 
and `timePeriodMillis` is the window size used for the sum and for the 
penalization period. The milliseconds conversion only runs once, when a 
Throttle is created, so I agree it is fine to keep it as it is.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to