Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit ab7671b

Browse files
authored
fix(retry): Fix retry strategy when all hosts are down (#356)
1 parent 91c57ca commit ab7671b

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

.travis.yml

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
language: java
22
jdk:
3-
- oraclejdk7
3+
- openjdk7 #oraclejdk7 is not available on trusty because it's EOL
44
- oraclejdk8
5+
56
after_success:
67
- mvn -e -X clean test jacoco:report coveralls:jacoco
8+
79
env:
810
global:
911
- VERBOSE=1
1012

11-
# force non-container build
12-
sudo: required
13-
# workaround for https://github.com/travis-ci/travis-ci/issues/5227
14-
before_install:
15-
- cat /etc/hosts # optionally check the content *before*
16-
- sudo hostname "$(hostname | cut -c1-63)"
17-
- sed -e "s/^\\(127\\.0\\.0\\.1.*\\)/\\1 $(hostname | cut -c1-63)/" /etc/hosts | sudo tee /etc/hosts
18-
- cat /etc/hosts # optionally check the content *after*
13+
## force non-container build
14+
#sudo: required
15+
## workaround for https://github.com/travis-ci/travis-ci/issues/5227
16+
#before_install:
17+
# - cat /etc/hosts # optionally check the content *before*
18+
# - sudo hostname "$(hostname | cut -c1-63)"
19+
# - sed -e "s/^\\(127\\.0\\.0\\.1.*\\)/\\1 $(hostname | cut -c1-63)/" /etc/hosts | sudo tee /etc/hosts
20+
# - cat /etc/hosts # optionally check the content *after*

ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Changelog
22
=========
33

4+
1.12.1 (2017-10-09)
5+
-------------------
6+
- Fix retry strategy when all hosts are down
7+
48
1.12.0 (2017-08-22)
59
-------------------
610
- Rename Key to ApiKey

src/main/java/com/algolia/search/saas/APIClient.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,12 @@ private List<String> hostsThatAreUp(List<String> hosts) {
11571157
result.add(host);
11581158
}
11591159
}
1160-
return result;
1160+
1161+
if (result.isEmpty()) {
1162+
return hosts;
1163+
} else {
1164+
return result;
1165+
}
11611166
}
11621167

11631168
private boolean isHostUpOrCouldBeRetried(String host) {

0 commit comments

Comments
 (0)