From a1a90ed5d0a79940fc1528d2e7ec061e4a3323d4 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Fri, 15 Sep 2017 00:14:09 +0530 Subject: [PATCH] while loop code formating --- hosting/views.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/hosting/views.py b/hosting/views.py index 4d9aeb18..290d5f0f 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -968,14 +968,16 @@ class VirtualMachineView(LoginRequiredMixin, View): # ) t = 0 while True: - if t > 150: - break - try: - manager.get_vm(self.kwargs.get('pk')) - except BaseException: - break + if t < 150: + t += 1 + try: + manager.get_vm(self.kwargs.get('pk')) + except BaseException: + break + else: + sleep(2) else: - sleep(2) + break response['status'] = True response['redirect'] = self.get_success_url()