Commit 5254e2ad by Őry Máté

vm: rewrite abort-checking loop

parent ae821278
...@@ -73,7 +73,7 @@ class AbortableRemoteOperationMixin(object): ...@@ -73,7 +73,7 @@ class AbortableRemoteOperationMixin(object):
args = self._get_remote_args(**kwargs), args = self._get_remote_args(**kwargs),
remote = self.task.apply_async( remote = self.task.apply_async(
args=args, queue=self._get_remote_queue()) args=args, queue=self._get_remote_queue())
for i in xrange(int(self.remote_timeout / self.remote_step)): for i in xrange(0, self.remote_timeout, self.remote_step):
try: try:
return remote.get(timeout=self.remote_step) return remote.get(timeout=self.remote_step)
except TimeoutError as e: except TimeoutError as e:
...@@ -81,7 +81,6 @@ class AbortableRemoteOperationMixin(object): ...@@ -81,7 +81,6 @@ class AbortableRemoteOperationMixin(object):
AbortableAsyncResult(remote.id).abort() AbortableAsyncResult(remote.id).abort()
raise humanize_exception(ugettext_noop( raise humanize_exception(ugettext_noop(
"Operation aborted by user."), e) "Operation aborted by user."), e)
return remote.get(timeout=self.remote_step)
class InstanceOperation(Operation): class InstanceOperation(Operation):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment