|
15 | 15 | # Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/ |
16 | 16 | # Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic |
17 | 17 | # changes) |
18 | | -CLIENT_VERSION = "1.3.42" |
| 18 | +CLIENT_VERSION = "1.3.43" |
19 | 19 |
|
20 | 20 | # Timeout for analysis with Cppcheck in seconds |
21 | 21 | CPPCHECK_TIMEOUT = 30 * 60 |
@@ -253,31 +253,37 @@ def get_cppcheck_versions(): |
253 | 253 |
|
254 | 254 |
|
255 | 255 | def get_packages_count(): |
256 | | - print('Connecting to server to get count of packages..') |
257 | | - with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: |
258 | | - sock.connect(__server_address) |
259 | | - sock.send(b'getPackagesCount\n') |
260 | | - packages = sock.recv(64) |
261 | | - # TODO: sock.recv() sometimes hangs and returns b'' afterwards |
262 | | - if not packages: |
263 | | - raise Exception('received empty response') |
264 | | - return int(packages) |
| 256 | + def __get_packages_count(): |
| 257 | + print('Connecting to server to get count of packages..') |
| 258 | + with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: |
| 259 | + sock.connect(__server_address) |
| 260 | + sock.send(b'getPackagesCount\n') |
| 261 | + packages = sock.recv(64) |
| 262 | + # TODO: sock.recv() sometimes hangs and returns b'' afterwards |
| 263 | + if not packages: |
| 264 | + raise Exception('received empty response') |
| 265 | + return int(packages) |
| 266 | + |
| 267 | + return try_retry(__get_packages_count) |
265 | 268 |
|
266 | 269 |
|
267 | 270 | def get_package(package_index=None): |
268 | | - print('Connecting to server to get assigned work..') |
269 | | - with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: |
270 | | - sock.connect(__server_address) |
271 | | - if package_index is None: |
272 | | - sock.send(b'get\n') |
273 | | - else: |
274 | | - request = 'getPackageIdx:' + str(package_index) + '\n' |
275 | | - sock.send(request.encode()) |
276 | | - package = sock.recv(256) |
277 | | - # TODO: sock.recv() sometimes hangs and returns b'' afterwards |
278 | | - if not package: |
279 | | - raise Exception('received empty response') |
280 | | - return package.decode('utf-8') |
| 271 | + def __get_package(package_index): |
| 272 | + print('Connecting to server to get assigned work..') |
| 273 | + with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: |
| 274 | + sock.connect(__server_address) |
| 275 | + if package_index is None: |
| 276 | + sock.send(b'get\n') |
| 277 | + else: |
| 278 | + request = 'getPackageIdx:' + str(package_index) + '\n' |
| 279 | + sock.send(request.encode()) |
| 280 | + package = sock.recv(256) |
| 281 | + # TODO: sock.recv() sometimes hangs and returns b'' afterwards |
| 282 | + if not package: |
| 283 | + raise Exception('received empty response') |
| 284 | + return package.decode('utf-8') |
| 285 | + |
| 286 | + return try_retry(__get_package, fargs=(package_index,), max_tries=3, sleep_duration=30.0, sleep_factor=1.0) |
281 | 287 |
|
282 | 288 |
|
283 | 289 | def __handle_remove_readonly(func, path, exc): |
|
0 commit comments