pyHPSU icon indicating copy to clipboard operation
pyHPSU copied to clipboard

pyHPSU.py - rendere retry configurabili

Open EmilianoMaina opened this issue 8 years ago • 0 comments

Estrarre dal codice e mettere in file di configurazione:

  • il numero di tentativi di retry (4)
  • il tempo di ritardo tra un retry ed il prossimo (2)

Grazie !

for c in hpsu.commands: i = 0 while i <= 3: rc = hpsu.sendCommand(c) if rc != "KO": i = 4 response = hpsu.parseCommand(cmd=c, response=rc, verbose=verbose) resp = hpsu.umConversion(cmd=c, response=response, verbose=verbose)

            arrResponse.append({"name":c["name"], "resp":resp, "timestamp":response["timestamp"]})
        else:
            i += 1
            **time.sleep(2.0)**
            hpsu.printd('warning', 'retry %s command %s' % (i, c["name"]))
            **if i == 4:**
                hpsu.printd('error', 'command %s failed' % (c["name"]))

EmilianoMaina avatar Feb 15 '17 06:02 EmilianoMaina