Copilot commented on code in PR #6428:
URL: https://github.com/apache/shenyu/pull/6428#discussion_r3609731771
##########
shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-divide/src/main/java/org/apache/shenyu/plugin/divide/DividePlugin.java:
##########
@@ -173,8 +173,8 @@ private DivideRuleHandle buildRuleHandle(final RuleData
rule) {
private void responseTrigger(final Upstream upstream) {
long now = System.currentTimeMillis();
upstream.getInflight().decrementAndGet();
- upstream.setResponseStamp(now);
long stamp = upstream.getResponseStamp();
+ upstream.setResponseStamp(now);
long td = now - stamp;
Review Comment:
The fix corrects the responseStamp get/set order, but there is no test
coverage that would have caught the original bug (td always 0 when oldLag != 0,
causing EWMA to stop updating). Consider extending the existing
DividePluginTest.responseTriggerTest to set upstream.lag to a non-zero value
and pre-set responseStamp to an older timestamp, then assert that a subsequent
responseTrigger call updates lag (i.e., newLag != oldLag / newLag trends toward
(now-lastPicked)).
--
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]