algoliasearch 1.12.3 → 1.12.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +3 -0
- data/lib/algolia/version.rb +1 -1
- data/spec/client_spec.rb +29 -26
- data/spec/mock_spec.rb +2 -0
- data/spec/stub_spec.rb +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9f41ca052e472677a2d5ace620a14667d504ef2
|
4
|
+
data.tar.gz: 9d5867b170153d28d6e09d96b925ba5fb56816d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0264feea12af5aa3ce81b87963e91131ee083f27db9e7ad09276040c29f72e1415832b60cbeb3692fd2ab6802ed7ad716ad223fa2947ceba22e6ce47507f9224
|
7
|
+
data.tar.gz: 7a22070b0bc43b1085ce606ab1d0593e05b76a3b20aa265d585d39498ac8434d4ee0913c84535944a017f87103d1b2922e61532bd83f8b833f8f7c830fc1c3ed
|
data/ChangeLog
CHANGED
data/lib/algolia/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -978,34 +978,37 @@ describe 'Client' do
|
|
978
978
|
@index.search_synonyms('')['nbHits'].should eq(0)
|
979
979
|
end
|
980
980
|
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
],
|
992
|
-
|
993
|
-
|
981
|
+
context 'DNS timeout' do
|
982
|
+
before(:all) do
|
983
|
+
app_id = ENV['ALGOLIA_APPLICATION_ID']
|
984
|
+
Thread.current["algolia_hosts_#{app_id}"] = nil
|
985
|
+
Thread.current["algolia_search_hosts_#{app_id}"] = nil
|
986
|
+
Thread.current["algolia_host_index_#{app_id}"] = nil
|
987
|
+
Thread.current["algolia_search_host_index_#{app_id}"] = nil
|
988
|
+
@client = Algolia::Client.new :application_id => ENV['ALGOLIA_APPLICATION_ID'], :api_key => ENV['ALGOLIA_API_KEY'],
|
989
|
+
:hosts => [
|
990
|
+
"#{ENV['ALGOLIA_APPLICATION_ID']}.algolia.biz",
|
991
|
+
"#{ENV['ALGOLIA_APPLICATION_ID']}.algolia.net",
|
992
|
+
"#{ENV['ALGOLIA_APPLICATION_ID']}-1.algolianet.com",
|
993
|
+
"#{ENV['ALGOLIA_APPLICATION_ID']}-2.algolianet.com",
|
994
|
+
"#{ENV['ALGOLIA_APPLICATION_ID']}-3.algolianet.com"
|
995
|
+
],
|
996
|
+
:connect_timeout => 5
|
997
|
+
end
|
994
998
|
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
999
|
+
it "should fallback to the 2nd host after a few seconds" do
|
1000
|
+
start_time = Time.now
|
1001
|
+
@client.list_indexes # fallback on the second host after 5 sec (connection timeout)
|
1002
|
+
expect(start_time.to_i + 5).to be <= Time.now.to_i + 1
|
1003
|
+
end
|
1000
1004
|
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
end
|
1005
|
+
it "should re-use the working (2nd) host after the 1st one failed" do
|
1006
|
+
start_time = Time.now
|
1007
|
+
@client.list_indexes # fallback on the second host after 5 sec (connection timeout)
|
1008
|
+
expect(start_time.to_i + 5).to be <= Time.now.to_i + 1
|
1009
|
+
start_time = Time.now
|
1010
|
+
@client.list_indexes # re-use the 2nd one
|
1011
|
+
expect(start_time.to_i).to be <= Time.now.to_i + 1
|
1009
1012
|
end
|
1010
1013
|
end
|
1011
1014
|
|
data/spec/mock_spec.rb
CHANGED
@@ -11,6 +11,8 @@ describe 'With a mocked client' do
|
|
11
11
|
app_id = Algolia.client.application_id
|
12
12
|
Thread.current["algolia_hosts_#{app_id}"] = nil
|
13
13
|
Thread.current["algolia_search_hosts_#{app_id}"] = nil
|
14
|
+
Thread.current["algolia_host_index_#{app_id}"] = nil
|
15
|
+
Thread.current["algolia_search_host_index_#{app_id}"] = nil
|
14
16
|
end
|
15
17
|
|
16
18
|
it "should add a simple object" do
|
data/spec/stub_spec.rb
CHANGED
@@ -10,6 +10,8 @@ describe 'With a rate limited client' do
|
|
10
10
|
app_id = Algolia.client.application_id
|
11
11
|
Thread.current["algolia_hosts_#{app_id}"] = nil
|
12
12
|
Thread.current["algolia_search_hosts_#{app_id}"] = nil
|
13
|
+
Thread.current["algolia_host_index_#{app_id}"] = nil
|
14
|
+
Thread.current["algolia_search_host_index_#{app_id}"] = nil
|
13
15
|
end
|
14
16
|
|
15
17
|
it "should pass the right headers" do
|