Browse Source

Reconnect on httplib.ResponseNotReady

In CI we get a random ResponseNotReady exception,
which is caused by the server closing the keepalive socket.
This will close and retry the connection.

Change-Id: I28e51450cbfea8bf7a18e5783355b68f806eb999
tags/1.0.22
Grzegorz Grasza 7 months ago
parent
commit
e8ced3d13c
1 changed files with 10 additions and 0 deletions
  1. 10
    0
      novajoin/ipa.py

+ 10
- 0
novajoin/ipa.py View File

@@ -17,6 +17,9 @@ import os
17 17
 import time
18 18
 import uuid
19 19
 
20
+from six.moves import http_client
21
+
22
+
20 23
 try:
21 24
     from gssapi.exceptions import GSSError
22 25
     from ipalib import api
@@ -161,6 +164,13 @@ class IPANovaJoinBase(object):
161 164
                 tries += 1
162 165
                 if self.backoff:
163 166
                     self.__backoff()
167
+            except http_client.ResponseNotReady:
168
+                # NOTE(xek): This means that the server closed the socket,
169
+                # so keep-alive ended and we can't use that connection.
170
+                api.Backend.rpcclient.disconnect()
171
+                tries += 1
172
+                if self.backoff:
173
+                    self.__backoff()
164 174
             else:
165 175
                 return
166 176
 

Loading…
Cancel
Save