Moved eventlet monkey_patch before app is imported

In cmd/api.py the eventlet monkey_patch has been moved to be before api
app import. This is because if it's called too late, the api app and
db api module will be loaded without awareness of eventlet, the
threading local context in db api won't be eventlet compatible, causing
DB parallel operation errors.

Change-Id: I294657fc910c6a4696f91308d60697d005dc53b0
Closes-Bug: 1846411
Signed-off-by: Andy Ning <andy.ning@windriver.com>
This commit is contained in:
Andy Ning 2019-10-03 11:23:31 -04:00
parent 36702d225c
commit 3e2eccea4a
4 changed files with 8 additions and 4 deletions

View File

@ -25,6 +25,8 @@
import sys
import eventlet
eventlet.monkey_patch(os=False)
from oslo_config import cfg
from oslo_log import log as logging
from oslo_service import systemd
@ -41,7 +43,6 @@ from dcdbsync.common import messaging
CONF = cfg.CONF
config.register_options()
LOG = logging.getLogger('dcdbsync.api')
eventlet.monkey_patch(os=False)
def main():

View File

@ -27,6 +27,8 @@
import sys
import eventlet
eventlet.monkey_patch(os=False)
from oslo_config import cfg
from oslo_log import log as logging
from oslo_service import systemd
@ -43,7 +45,6 @@ from dcorch.common import messaging as dcorch_messaging
CONF = cfg.CONF
config.register_options()
LOG = logging.getLogger('dcmanager.api')
eventlet.monkey_patch(os=False)
def main():

View File

@ -20,6 +20,8 @@
import sys
import eventlet
eventlet.monkey_patch(os=False)
from oslo_config import cfg
from oslo_log import log as logging
from oslo_service import systemd
@ -36,7 +38,6 @@ from dcorch.common import messaging
CONF = cfg.CONF
config.register_options()
LOG = logging.getLogger('dcorch.api')
eventlet.monkey_patch(os=False)
def main():

View File

@ -20,6 +20,8 @@
import sys
import eventlet
eventlet.monkey_patch(os=False)
from oslo_config import cfg
from oslo_log import log as logging
from oslo_service import systemd
@ -58,7 +60,6 @@ config.register_options()
CONF.register_cli_opts(proxy_cli_opts)
LOG = logging.getLogger('dcorch.api.proxy')
eventlet.monkey_patch(os=False)
def main():