diff --git a/pori_python/ipr/connection.py b/pori_python/ipr/connection.py index 3d83554..a7a372f 100644 --- a/pori_python/ipr/connection.py +++ b/pori_python/ipr/connection.py @@ -93,14 +93,17 @@ def check_status(interval: int = 5, num_attempts: int = 5): return current_status current_status = check_status() + if current_status['state'] in ['active', 'waiting']: current_status = check_status(interval=30) - if current_status['state'] == ['active', 'waiting']: - current_status = check_status(interval=60, num_attempts=mins_to_wait) - if current_status['state'] == ['active', 'waiting']: - raise Exception( - f'async report upload taking longer than expected: {current_status}' - ) + + if current_status['state'] in ['active', 'waiting']: + current_status = check_status(interval=60, num_attempts=mins_to_wait) + + if current_status['state'] in ['active', 'waiting']: + raise Exception( + f'async report upload taking longer than expected: {current_status}' + ) return current_status else: return self.post('reports', content)