fix: while 循环做card_door_authority的补偿机制2
This commit is contained in:
parent
8d3d1934b7
commit
a395817028
|
@ -193,18 +193,30 @@ class HrmService:
|
|||
"cardPrivilegeDetails": details
|
||||
}
|
||||
ind = 0
|
||||
exception = None
|
||||
while ind < 6:
|
||||
time.sleep(5)
|
||||
is_ok, res = dhClient.request(**dhapis['card_door_authority'], json=json_data, raise_exception=False)
|
||||
if is_ok == 'success':
|
||||
break
|
||||
elif is_ok == 'fail' and '44999999' in res['code']:
|
||||
time.sleep(6)
|
||||
try:
|
||||
dhClient.request(**dhapis['card_door_authority'], json=json_data)
|
||||
exception = None
|
||||
except Exception as e:
|
||||
exception = e
|
||||
ind = ind + 1
|
||||
continue
|
||||
elif is_ok == 'fail':
|
||||
raise ParseError(**res)
|
||||
elif is_ok == 'error':
|
||||
raise APIException(**DH_REQUEST_ERROR)
|
||||
if exception:
|
||||
raise exception
|
||||
# while ind < 6:
|
||||
# time.sleep(5)
|
||||
# is_ok, res = dhClient.request(**dhapis['card_door_authority'], json=json_data, raise_exception=False)
|
||||
# if is_ok == 'success':
|
||||
# break
|
||||
# elif is_ok == 'fail' and '44999999' in res['code']:
|
||||
# if ind
|
||||
# ind = ind + 1
|
||||
# continue
|
||||
# elif is_ok == 'fail':
|
||||
# raise ParseError(**res)
|
||||
# elif is_ok == 'error':
|
||||
# raise APIException(**DH_REQUEST_ERROR)
|
||||
cls.save(ep, data={'dh_dchannels': dh_dchannels})
|
||||
return dh_dchannels
|
||||
|
||||
|
|
Loading…
Reference in New Issue