File tree 2 files changed +21
-1
lines changed
2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,8 @@ def get_rest_hosts(self):
146
146
if host is None :
147
147
return hosts
148
148
149
- if time .time () > self .__host_expires :
149
+ # unstore saved fallback host after fallbackRetryTimeout (RSC15f)
150
+ if self .__host_expires is not None and time .time () > self .__host_expires :
150
151
self .__host = None
151
152
self .__host_expires = None
152
153
return hosts
Original file line number Diff line number Diff line change
1
+ from ably import AblyRest
2
+
3
+
4
+ def test_http_get_rest_hosts_works_when_fallback_realtime_host_is_set ():
5
+ ably = AblyRest (token = "foo" )
6
+ ably .options .fallback_realtime_host = ably .options .get_rest_hosts ()[0 ]
7
+ # Should not raise TypeError
8
+ hosts = ably .http .get_rest_hosts ()
9
+ assert isinstance (hosts , list )
10
+ assert all (isinstance (host , str ) for host in hosts )
11
+
12
+
13
+ def test_http_get_rest_hosts_works_when_fallback_realtime_host_is_not_set ():
14
+ ably = AblyRest (token = "foo" )
15
+ ably .options .fallback_realtime_host = None
16
+ # Should not raise TypeError
17
+ hosts = ably .http .get_rest_hosts ()
18
+ assert isinstance (hosts , list )
19
+ assert all (isinstance (host , str ) for host in hosts )
You can’t perform that action at this time.
0 commit comments