
import eventlet
import greenlet

from openstack.common.messaging._executors import base


class EventletExecutor(base.ExecutorBase):

    def __init__(self, conf, listener, callback):
        super(EventletExecutor, self).__init__(conf, listener, callback)
        self._thread = None

    def start(self):
        if self._thread is not None:
            return

        def _executor_thread():
            try:
                while True:
            except greenlet.GreenletExit:
                return

        self._thread = eventlet.spawn(_executor_thread)

    def stop(self):
        if self._thread is None:
            return
        self._thread.kill()

    def wait(self):
        if self._thread is None:
            return
        try:
            self._thread.wait()
        except greenlet.GreenletExit:
            pass
        self._thread = None


import eventlet
import greenlet

from openstack.common.messaging._executors import base


class EventletExecutor(base.ExecutorBase):

    def __init__(self, conf, listener, callback):
        super(EventletExecutor, self).__init__(conf, listener, callback)
        self._thread = None

    def start(self):
        if self._thread is not None:
            return

        def _executor_thread():
            try:
                while True:
                    self._process_one_message()
            except greenlet.GreenletExit:
                return

        self._thread = eventlet.spawn(_executor_thread)

    def stop(self):
        if self._thread is None:
            return
        self._thread.kill()

    def wait(self):
        if self._thread is None:
            return
        try:
            self._thread.wait()
        except greenlet.GreenletExit:
            pass
        self._thread = None

Add forgotten piece of eventlet executor
Add forgotten piece of eventlet executor


  
  import eventlet
  import greenlet
  
  from openstack.common.messaging._executors import base
  
  
  class EventletExecutor(base.ExecutorBase):
  
      def __init__(self, conf, listener, callback):
          super(EventletExecutor, self).__init__(conf, listener, callback)
          self._thread = None
  
      def start(self):
          if self._thread is not None:
              return
  
          def _executor_thread():
              try:
                  while True:
+                     self._process_one_message()
              except greenlet.GreenletExit:
                  return
  
          self._thread = eventlet.spawn(_executor_thread)
  
      def stop(self):
          if self._thread is None:
              return
          self._thread.kill()
  
      def wait(self):
          if self._thread is None:
              return
          try:
              self._thread.wait()
          except greenlet.GreenletExit:
              pass
          self._thread = None
  
Add forgotten piece of eventlet executor
## Code Before:

import eventlet
import greenlet

from openstack.common.messaging._executors import base


class EventletExecutor(base.ExecutorBase):

    def __init__(self, conf, listener, callback):
        super(EventletExecutor, self).__init__(conf, listener, callback)
        self._thread = None

    def start(self):
        if self._thread is not None:
            return

        def _executor_thread():
            try:
                while True:
            except greenlet.GreenletExit:
                return

        self._thread = eventlet.spawn(_executor_thread)

    def stop(self):
        if self._thread is None:
            return
        self._thread.kill()

    def wait(self):
        if self._thread is None:
            return
        try:
            self._thread.wait()
        except greenlet.GreenletExit:
            pass
        self._thread = None

## Instruction:
Add forgotten piece of eventlet executor
## Code After:

import eventlet
import greenlet

from openstack.common.messaging._executors import base


class EventletExecutor(base.ExecutorBase):

    def __init__(self, conf, listener, callback):
        super(EventletExecutor, self).__init__(conf, listener, callback)
        self._thread = None

    def start(self):
        if self._thread is not None:
            return

        def _executor_thread():
            try:
                while True:
                    self._process_one_message()
            except greenlet.GreenletExit:
                return

        self._thread = eventlet.spawn(_executor_thread)

    def stop(self):
        if self._thread is None:
            return
        self._thread.kill()

    def wait(self):
        if self._thread is None:
            return
        try:
            self._thread.wait()
        except greenlet.GreenletExit:
            pass
        self._thread = None
