Skip to content

Conversation

@agshing
Copy link

@agshing agshing commented Dec 5, 2025

Adds a simple getter, getFixedBacklogTimeoutMillis(), to LifoBlockingLimiter so the fixed backlog timeout configured via the builder can be inspected and serialized.

This does not change limiter behavior; it only exposes existing configuration for introspection and tooling.

*/
public Builder<ContextT> backlogTimeoutMillis(long timeout) {
this.maxBacklogTimeoutMillis = context -> timeout;
this.configuredBacklogTimeoutMillis = timeout;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a function is set through backlogTimeout, should we clear the configuredBacklogTimeoutMillis?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s a great suggestion. For cleanup purposes, we probably should. If we switch to a dynamic function, there’s no single fixed timeout anymore, so configuredBacklogTimeoutMillis could be cleared. I’m going to make configuredBacklogTimeoutMillis a boxed value so we can clear it by assigning null.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

private final Limiter<ContextT> delegate;
private int maxBacklogSize = 100;
private Function<ContextT, Long> maxBacklogTimeoutMillis = context -> 1_000L;
private long configuredBacklogTimeoutMillis = 1_000L;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: is the goal to track the configured timeout or to quickly identify the value of any fixed timeout? If the latter, fixedBacklogTimeoutMillis would be a better name.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal is to expose the value only when a fixed timeout is configured, not to track historical configuration. fixedBacklogTimeoutMillis is indeed a more accurate name. I’ll update the field and getter accordingly.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

public long getConfiguredBacklogTimeoutMillis() {
return this.configuredBacklogTimeoutMillis;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that we also need to add a similar accessor to BlockingLimiter.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we? I dont think we use BlockingLimiter internally and it feels to it is a different kind of limiter(pls correct me if I am wrong). maxBacklogSize is not exposed into BlockingLimiter either.

I feel like my change is solving a very specific problem: expose configured backlog timeout in LifoBlockingLimiter

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@agshing agshing force-pushed the add-backlog-timeout-getter branch from fff42fb to 5a198dc Compare December 5, 2025 18:36
@agshing agshing force-pushed the add-backlog-timeout-getter branch from 5a198dc to 09a3971 Compare December 5, 2025 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants