Adriano Machado created CAMEL-26472:
---------------------------------------

             Summary: camel-core - Throttle EIP: do not reschedule the clean of 
the throttling state on every exchange
                 Key: CAMEL-26472
                 URL: https://issues.apache.org/jira/browse/CAMEL-26472
             Project: Camel
          Issue Type: Sub-task
            Reporter: Adriano Machado
            Assignee: Adriano Machado
             Fix For: 4.24.0


Tier 2 item of CAMEL\-25132. On every exchange, both throttler modes schedule a 
new clean of the throttling state and cancel the previous one, which takes the 
scheduled executor queue lock about three times. {{ThrottlePermit.compareTo}} 
also reads the clock twice per comparison, although it only needs to compare 
the two scheduled times.

The pending clean can be kept while it is not close to firing, and only 
rescheduled otherwise. In total requests mode the clean removes a state whose 
permits are all returned, even if they are still delayed \(see CAMEL\-25300\), 
so a clean must stay at least one period after the last return. Keeping it only 
while it is at least two periods away ensures that. A clean then runs between 8 
and 10 periods after the last permit was returned, instead of exactly 10.

_Claude Code on behalf of Adriano Machado \(@ammachado\)_

_This was generated by an AI agent and may contain inaccuracies. Please verify 
before relying on it._





--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to