Adding the timeout for the connection on the configuration database.
While accessing the configuration database from multiple session, it results in to the error - OperationError, because - sqlite locks all the database, and does not allow to access it simultaneously. We added the timeout to give some time window for accessing it simultaneously.pull/3/head
parent
8cfca280d4
commit
d8cbee3850
|
|
@ -160,6 +160,10 @@ SQLITE_PATH = os.path.join(
|
|||
os.path.realpath(os.path.expanduser('~/.pgadmin/')),
|
||||
'pgadmin4.db'
|
||||
)
|
||||
# SQLITE_TIMEOUT will define how long to wait before throwing the error -
|
||||
# OperationError due to database lock.
|
||||
# (Default: 500 milliseconds)
|
||||
SQLITE_TIMEOUT = 500
|
||||
|
||||
##########################################################################
|
||||
# Server-side session storage path
|
||||
|
|
|
|||
|
|
@ -169,9 +169,10 @@ def create_app(app_name=config.APP_NAME):
|
|||
# Setup authentication
|
||||
##########################################################################
|
||||
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///{0}'.format(
|
||||
config.SQLITE_PATH.replace('\\', '/')
|
||||
)
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///{0}?timeout={1}'.format(
|
||||
config.SQLITE_PATH.replace('\\', '/'),
|
||||
getattr(config, 'SQLITE_TIMEOUT', 500)
|
||||
)
|
||||
|
||||
# Only enable password related functionality in server mode.
|
||||
if config.SERVER_MODE is True:
|
||||
|
|
|
|||
Loading…
Reference in New Issue