David Young created NIFI-16559:
----------------------------------

             Summary: Fix ControlRate clearExpiredThrottles
                 Key: NIFI-16559
                 URL: https://issues.apache.org/jira/browse/NIFI-16559
             Project: Apache NiFi
          Issue Type: Bug
            Reporter: David Young
            Assignee: David Young


The code as written in ControlRate#clearExpiredThresholds copies the 
`dataThrottleMap` and `countThrottleMap` to an intermediate `throttleMap` based 
on which modes are enabled. 

Although it's done using a view, looping over the `throttleMap` and calling 
remove on the intermediate map does not actually call back to the original maps 
to remove those elements.

Proposal: extract the iteration logic out to a separate function and call it 
once for each of the maps. Reduces the need to copy items into a separate list 
and actually removes the expired throttles from the map.

 

Initially I thought the logic was sound until I prompted GPT with it and asked 
it to validate my thought process. It provided a bit of sample code that I 
tested and reviewed to validate that the removal wasn't actually happening as 
expected. Additionally, I gave a similar question to Gemini and without 
pointing out the exact suspicion, it suggested a similar fix for the same 
issue. 



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

Reply via email to