代码优化 (#9752)

调整timeout位置
This commit is contained in:
zhuyou1234 2023-01-03 11:57:36 +08:00 committed by GitHub
parent 7e24ab9f6c
commit ef212ccad1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -246,11 +246,12 @@ public class LongPollingService {
int delayTime = SwitchService.getSwitchInteger(SwitchService.FIXED_DELAY_TIME, 500);
// Add delay time for LoadBalance, and one response is returned 500 ms in advance to avoid client timeout.
long timeout = Math.max(10000, Long.parseLong(str) - delayTime);
long timeout = -1L;
if (isFixedPolling()) {
timeout = Math.max(10000, getFixedPollingInterval());
// Do nothing but set fix polling timeout.
} else {
timeout = Math.max(10000, Long.parseLong(str) - delayTime);
long start = System.currentTimeMillis();
List<String> changedGroups = MD5Util.compareMd5(req, rsp, clientMd5Map);
if (changedGroups.size() > 0) {