Rate limiting is an important mechanism for controlling resource utilization and maintaining quality of service. F# supports rate limiting with asynchronous workflows and MailboxProcessor.
Running our program we see the first batch of requests handled once every ~200 milliseconds as desired.
For the second batch of requests we serve the first 3 immediately because of the burstable rate limiting, then serve the remaining 2 with ~200ms delays each.
In this F# version, we use MailboxProcessor as a channel-like construct to handle requests. The Timer class is used to implement the rate limiting, and SemaphoreSlim is used for the bursty limiter. The overall structure and logic of the program remain similar to the original, demonstrating basic and bursty rate limiting in F#.