From 563d4f53886d16ffd7a85304bc2910b31f3fb101 Mon Sep 17 00:00:00 2001
From: Chris Pomeroy <chris.pomeroy@hotmail.com>
Date: Fri, 23 Mar 2018 01:09:49 +0000
Subject: [PATCH] Added retry for the Checkkey function
---
aaxConvert.py | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/aaxConvert.py b/aaxConvert.py
index 672553b..9752304 100755
--- a/aaxConvert.py
+++ b/aaxConvert.py
@@ -7,6 +7,7 @@
import json
import requests
from querysubsonic import findalbumbyname
+from time import sleep
# arguments
@@ -138,12 +139,17 @@
def getcorrectkey(aaxfile):
hex = filechecksum(aaxfile)
payload = hex
- r = requests.post('http://x86-docker01:8080/function/checkkey', payload, verify=False, timeout=None)
- if r.status_code == 200:
- key = r.text
- else:
- print('Checkkey function is down please wait')
- return key
+ recovery = 3
+ while recovery != 0:
+ r = requests.post('http://x86-docker01:8080/function/checkkey', payload, verify=False, timeout=None)
+ if r.status_code == 200:
+ key = r.text
+ recovery = 0
+ else:
+ print('Checkkey function is down please wait')
+ recovery = recovery - 1
+ sleep(5)
+ return key
for rfile in glob.glob(args.filename):
if rfile.find("aax") != -1 and os.path.isfile(rfile):
--
Gitblit v1.10.0