[ 
https://issues.apache.org/jira/browse/NIFI-16559?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18146465#comment-18146465
 ] 

ASF subversion and git services commented on NIFI-16559:
--------------------------------------------------------

Commit 20ee05500cbd5476f20e8832dd02d62ebb8e7433 in nifi's branch 
refs/heads/main from David Young
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=20ee05500cb ]

NIFI-16559: Fix ControlRate clearExpiredThrottle logic (#11903)

> 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
>            Priority: Minor
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> 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