zentol commented on code in PR #20757:
URL: https://github.com/apache/flink/pull/20757#discussion_r968181727
##########
flink-core/src/main/java/org/apache/flink/api/connector/source/lib/util/RateLimiter.java:
##########
@@ -22,8 +22,14 @@
import java.util.concurrent.CompletionStage;
/** The interface to rate limit execution of methods. */
-interface RateLimiter extends Serializable {
+public interface RateLimiter extends Serializable {
/** Returns a future that is completed once another event would not exceed
the rate limit. */
CompletionStage<Void> acquire();
+
+ /**
+ * Can be used to modify rate-limiter's behaviour from the outside. Makes
it possible to
+ * implement rate limiters based on external events rather than on time.
+ */
+ default void notifyRelease() {}
Review Comment:
> Should we add CheckpointAwareRateLimiter implements RateLimiter to keep
the RateLimiter more high-level?
The idea is good but how'd that work in practice though?
The RateLimitedSourceReader would have to accept a
CheckpointAwareRateLimiter via the constructor which leaks upwards, unless we
do a instanceof check + cast _somewhere_.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]