Unverified Commit 2f23140b by Jason Song Committed by GitHub

Merge pull request #1003 from nobodyiam/adjust-long-polling-timeout

Adjust long polling timeout
parents 92ee12c6 bbdf8e55
...@@ -54,6 +54,8 @@ public class RemoteConfigLongPollService { ...@@ -54,6 +54,8 @@ public class RemoteConfigLongPollService {
private static final Joiner.MapJoiner MAP_JOINER = Joiner.on("&").withKeyValueSeparator("="); private static final Joiner.MapJoiner MAP_JOINER = Joiner.on("&").withKeyValueSeparator("=");
private static final Escaper queryParamEscaper = UrlEscapers.urlFormParameterEscaper(); private static final Escaper queryParamEscaper = UrlEscapers.urlFormParameterEscaper();
private static final long INIT_NOTIFICATION_ID = ConfigConsts.NOTIFICATION_ID_PLACEHOLDER; private static final long INIT_NOTIFICATION_ID = ConfigConsts.NOTIFICATION_ID_PLACEHOLDER;
//90 seconds, should be longer than server side's long polling timeout, which is now 60 seconds
private static final int LONG_POLLING_READ_TIMEOUT = 90 * 1000;
private final ExecutorService m_longPollingService; private final ExecutorService m_longPollingService;
private final AtomicBoolean m_longPollingStopped; private final AtomicBoolean m_longPollingStopped;
private SchedulePolicy m_longPollFailSchedulePolicyInSecond; private SchedulePolicy m_longPollFailSchedulePolicyInSecond;
...@@ -161,8 +163,7 @@ public class RemoteConfigLongPollService { ...@@ -161,8 +163,7 @@ public class RemoteConfigLongPollService {
logger.debug("Long polling from {}", url); logger.debug("Long polling from {}", url);
HttpRequest request = new HttpRequest(url); HttpRequest request = new HttpRequest(url);
//longer timeout for read - 10 minutes request.setReadTimeout(LONG_POLLING_READ_TIMEOUT);
request.setReadTimeout(600000);
transaction.addData("Url", url); transaction.addData("Url", url);
......
...@@ -17,7 +17,7 @@ import java.util.Map; ...@@ -17,7 +17,7 @@ import java.util.Map;
* @author Jason Song(song_s@ctrip.com) * @author Jason Song(song_s@ctrip.com)
*/ */
public class DeferredResultWrapper { public class DeferredResultWrapper {
private static final long TIMEOUT = 30 * 1000;//30 seconds private static final long TIMEOUT = 60 * 1000;//60 seconds
private static final ResponseEntity<List<ApolloConfigNotification>> private static final ResponseEntity<List<ApolloConfigNotification>>
NOT_MODIFIED_RESPONSE_LIST = new ResponseEntity<>(HttpStatus.NOT_MODIFIED); NOT_MODIFIED_RESPONSE_LIST = new ResponseEntity<>(HttpStatus.NOT_MODIFIED);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment