@@ -417,18 +417,30 @@ maxBuffer n st =
417417getMaxBuffer :: Config -> Limit
418418getMaxBuffer = _bufferHigh
419419
420−-- | Specify the pull rate of a channel.
421−-- A 'Nothing' value resets the rate to default which is unlimited. When the
422−-- rate is specified, concurrent production may be ramped up or down
423−-- automatically to achieve the specified yield rate. The specific behavior for
424−-- different styles of 'Rate' specifications is documented under 'Rate'. The
425−-- effective maximum production rate achieved by a channel is governed by:
420+-- | Specify the stream evaluation rate of a channel.
421+--
422+-- A 'Nothing' value means there is no smart rate control, concurrent execution
423+-- blocks only if 'maxThreads' or 'maxBuffer' is reached, or there are no more
424+-- concurrent tasks to execute. This is the default.
425+--
426+-- When rate (throughput) is specified, concurrent production may be ramped
427+-- up or down automatically to achieve the specified stream throughput. The
428+-- specific behavior for different styles of 'Rate' specifications is
429+-- documented under 'Rate'. The effective maximum production rate achieved by
430+-- a channel is governed by:
426431--
427432-- * The 'maxThreads' limit
428433-- * The 'maxBuffer' limit
429434-- * The maximum rate that the stream producer can achieve
430435-- * The maximum rate that the stream consumer can achieve
431436--
437+-- Maximum production rate is given by:
438+--
439+-- \(rate = \frac{maxThreads}{latency}\)
440+--
441+-- If we know the average latency of the tasks we can set 'maxThreads'
442+-- accordingly.
443+--
432444rate :: Maybe Rate -> Config -> Config
433445rate r st = st { _maxStreamRate = r }
434446