# Test updating the configuration of the rate limiter.

init
rate:  2
burst: 4
read:  { perbatch: 1, perrequest: 1, perbyte: 0.1 }
write: { perbatch: 1, perrequest: 1, perbyte: 0.1 }
----
00:00:00.000

get_tenants
- 2
----
[2#1]

# Launch a request that puts the limiter in debt by 2.

launch
- { id: g1, tenant: 2, writerequests: 2, writebytes: 30 }
----
[g1@2]

await
- g1
----
[]

# Launch a request that will require 4, it will need to block for 3s to deal
# with the current debt.

launch
- { id: g1, tenant: 2, writerequests: 1, writebytes: 20 }
----
[g1@2]

# Observe that the request will need to wait 3s.

timers
----
00:00:03.000

# Advance time by a second, at this point the debt should be paid and the
# limiter should have zero units available.

advance
1s
----
00:00:01.000

# Update the settings to double the rate but reduce the burst.

update_settings
rate:  4
burst: 2
----
00:00:01.000

# Observe that the timer has been updated to reflect the rate change.

timers
----
00:00:02.000

# Advance to the timer and observe that the request is unblocked.

advance
1s
----
00:00:02.000

await
- g1
----
[]
