Copyright (c) 2021, Joakim Brännström. All rights reserved.
Authors
Joakim Brännström (joakim.brannstrom@gmx.com)
An actor that can limit the flow of messages between consumer/producer.
The limiter is initialized with a number of tokens.
Producers try and take a token from the limiter. Either one is free and they
get it right away or a promise is returned. The promise will trigger whenever
a token is returned by the consumre. The waiting producers are triggered in
LIFO (just because that is a more efficient data structure).
A consumer receiver a message from a producer containing the token and data.
When the consumer has finished processing the message it returns the token to
the limier.