@@ -43,7 +43,7 @@ Provides smooth rate limiting with continuous rolling time windows:
4343# Allow 3 operations within any 1-second sliding window
4444timing = Async ::Limiter ::Timing ::SlidingWindow .new (
4545 1.0 , # 1-second window
46- Async ::Limiter ::Timing ::BurstStrategy ::Greedy , # Burst behavior
46+ Async ::Limiter ::Timing ::Burst ::Greedy , # Burst behavior
4747 3 # 3 operations per window
4848)
4949
@@ -67,14 +67,14 @@ Different burst behaviors affect how operations are scheduled:
6767# Greedy: Allow immediate bursts up to the limit
6868greedy_timing = Async ::Limiter ::Timing ::SlidingWindow .new (
6969 2.0 , # 2-second window
70- Async ::Limiter ::Timing ::BurstStrategy ::Greedy , # Allow bursts
70+ Async ::Limiter ::Timing ::Burst ::Greedy , # Allow bursts
7171 6 # 6 operations per 2 seconds
7272)
7373
7474# Conservative: Spread operations evenly over time
7575conservative_timing = Async ::Limiter ::Timing ::SlidingWindow .new (
7676 2.0 , # 2-second window
77- Async ::Limiter ::Timing ::BurstStrategy ::Conservative , # Even distribution
77+ Async ::Limiter ::Timing ::Burst ::Conservative , # Even distribution
7878 6 # 6 operations per 2 seconds
7979)
8080
@@ -107,7 +107,7 @@ Operations can consume different amounts of the rate limit:
107107``` ruby
108108timing = Async ::Limiter ::Timing ::SlidingWindow .new (
109109 1.0 , # 1-second window
110- Async ::Limiter ::Timing ::BurstStrategy ::Greedy ,
110+ Async ::Limiter ::Timing ::Burst ::Greedy ,
111111 10.0 # 10 units per second
112112)
113113
@@ -143,7 +143,7 @@ Provides rate limiting with discrete time boundaries:
143143# Allow 5 operations per 2-second window with fixed boundaries
144144timing = Async ::Limiter ::Timing ::FixedWindow .new (
145145 2.0 , # 2-second windows
146- Async ::Limiter ::Timing ::BurstStrategy ::Greedy , # Allow bursting within window
146+ Async ::Limiter ::Timing ::Burst ::Greedy , # Allow bursting within window
147147 5 # 5 operations per window
148148)
149149
166166# Demonstrate window boundaries
167167timing = Async ::Limiter ::Timing ::FixedWindow .new (
168168 1.0 , # 1-second windows
169- Async ::Limiter ::Timing ::BurstStrategy ::Greedy ,
169+ Async ::Limiter ::Timing ::Burst ::Greedy ,
170170 3 # 3 operations per window
171171)
172172
@@ -193,12 +193,12 @@ end
193193``` ruby
194194# Greedy allows all operations immediately within each window
195195greedy_timing = Async ::Limiter ::Timing ::FixedWindow .new (
196- 2.0 , Async ::Limiter ::Timing ::BurstStrategy ::Greedy , 4
196+ 2.0 , Async ::Limiter ::Timing ::Burst ::Greedy , 4
197197)
198198
199199# Conservative spreads operations evenly within each window
200200conservative_timing = Async ::Limiter ::Timing ::FixedWindow .new (
201- 2.0 , Async ::Limiter ::Timing ::BurstStrategy ::Conservative , 4
201+ 2.0 , Async ::Limiter ::Timing ::Burst ::Conservative , 4
202202)
203203
204204puts " === Greedy Fixed Window ==="
@@ -342,7 +342,7 @@ Pure rate limiting without concurrency constraints:
342342``` ruby
343343# Unlimited concurrency, but rate limited
344344timing = Async ::Limiter ::Timing ::SlidingWindow .new (1.0 ,
345- Async ::Limiter ::Timing ::BurstStrategy ::Greedy , 5 )
345+ Async ::Limiter ::Timing ::Burst ::Greedy , 5 )
346346
347347limiter = Async ::Limiter ::Generic .new (timing: timing)
348348
@@ -389,7 +389,7 @@ queue = Async::Queue.new
389389
390390# Add timing constraint
391391timing = Async ::Limiter ::Timing ::FixedWindow .new (2.0 ,
392- Async ::Limiter ::Timing ::BurstStrategy ::Greedy , 4 )
392+ Async ::Limiter ::Timing ::Burst ::Greedy , 4 )
393393
394394limiter = Async ::Limiter ::Queued .new (queue, timing: timing)
395395
@@ -484,7 +484,7 @@ class JobProcessor
484484 # Process jobs in batches every 30 seconds, up to 50 jobs per batch
485485 timing = Async ::Limiter ::Timing ::FixedWindow .new (
486486 30.0 , # 30-second windows
487- Async ::Limiter ::Timing ::BurstStrategy ::Greedy ,
487+ Async ::Limiter ::Timing ::Burst ::Greedy ,
488488 50 # 50 jobs per window
489489 )
490490
0 commit comments