donate-cpu: try to handle exceptions when uploading better
This commit is contained in:
parent
0ad757fc78
commit
e501b6a460
|
@ -252,13 +252,16 @@ def sendAll(connection, data):
|
||||||
|
|
||||||
def uploadResults(package, results):
|
def uploadResults(package, results):
|
||||||
print('Uploading results..')
|
print('Uploading results..')
|
||||||
|
for retry in range(4):
|
||||||
|
try:
|
||||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
server_address = ('cppcheck.osuosl.org', 8000)
|
server_address = ('cppcheck.osuosl.org', 8000)
|
||||||
sock.connect(server_address)
|
sock.connect(server_address)
|
||||||
try:
|
|
||||||
sendAll(sock, 'write\n' + package + '\n' + results + '\nDONE')
|
sendAll(sock, 'write\n' + package + '\n' + results + '\nDONE')
|
||||||
sock.close()
|
sock.close()
|
||||||
except socket.error:
|
except socket.error:
|
||||||
|
print('Upload failed, retry in 60 seconds')
|
||||||
|
time.sleep(30)
|
||||||
pass
|
pass
|
||||||
return package
|
return package
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue