Skip to content

Commit

Permalink
Merge pull request #341 from Ouranosinc/dblog-multiprocess-safety
Browse files Browse the repository at this point in the history
Disabled connection pooling to make pywps fork()/clone() safe
  • Loading branch information
cehbrecht committed May 22, 2018
2 parents 73f29e7 + 203ae6d commit cde7d3d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pywps/dblog.py
Expand Up @@ -21,6 +21,7 @@
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, VARCHAR, Float, DateTime, LargeBinary
from sqlalchemy.orm import sessionmaker
from sqlalchemy.pool import NullPool

LOGGER = logging.getLogger('PYWPS')
_SESSION_MAKER = None
Expand Down Expand Up @@ -183,7 +184,7 @@ def get_session():
if database.startswith("sqlite") or database.startswith("memory"):
engine = sqlalchemy.create_engine(database, connect_args={'check_same_thread': False}, echo=echo)
else:
engine = sqlalchemy.create_engine(database, echo=echo)
engine = sqlalchemy.create_engine(database, echo=echo, poolclass=NullPool)
except sqlalchemy.exc.SQLAlchemyError as e:
raise NoApplicableCode("Could not connect to database: {}".format(e.message))

Expand Down

0 comments on commit cde7d3d

Please sign in to comment.