Browse Source

Minor updates to orthancPeers

Andrej Studen @ VBOX 1 day ago
parent
commit
379c4addaa
1 changed files with 6 additions and 1 deletions
  1. 6 1
      orthancPeers.py

+ 6 - 1
orthancPeers.py

@@ -72,7 +72,12 @@ class orthancPeers:
             time.sleep(tSleep)
             jobStatus=self.checkJobStatus(jobId)
             if jobStatus['State']=="Success":
+                print('Job succeeded')
                 return
+            if jobStatus['State']=="Failure":
+                print('Job failed')
+                return
+
             try:
                 eta=datetime.datetime.strptime(jobStatus['EstimatedTimeOfArrival'],dateFormat)
             except KeyError:
@@ -80,7 +85,7 @@ class orthancPeers:
             t0=datetime.datetime.strptime(jobStatus['Timestamp'],dateFormat)
             delta=eta-t0
             tSleep=0.05*delta.seconds
-            tSleep=min(tSleep,tSleepGuess)
+            tSleep=max(tSleep,tSleepGuess)
             print('Working: {}/100, ETA: {} s, next check {} s'.format(jobStatus['Progress'],delta.seconds,tSleep))