Skip to content

Commit

Permalink
fix import uwsgi only when app start with uwsgi
Browse files Browse the repository at this point in the history
  • Loading branch information
David Durieux committed Feb 1, 2017
1 parent 733ffdc commit a325cae
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions alignak_backend/app.py
Expand Up @@ -19,7 +19,6 @@
import time
import traceback
import uuid
import uwsgi
from collections import OrderedDict
from datetime import datetime, timedelta
from future.utils import iteritems
Expand Down Expand Up @@ -1463,7 +1462,13 @@ def get_settings(prev_settings):
jobs = []
# run only sheduler on uwsgi worker 1, because option lazy-apps in uwsgi will run the
# scheduler on each worker and we don't want that ;)
if uwsgi.worker_id() == 1:
try:
import uwsgi
worker_id = uwsgi.worker_id()
except ImportError:
worker_id = 1

if worker_id == 1:
if settings['SCHEDULER_TIMESERIES_ACTIVE']:
jobs.append(
{
Expand Down

0 comments on commit a325cae

Please sign in to comment.