Skip to content
Permalink
Browse files

Make spare connections more explicit

  • Loading branch information
m-kuhn committed Aug 5, 2018
1 parent 6901b93 commit 0a0f84a96f9d2349d56344d40e34a3506ea8ae91
@@ -801,7 +801,12 @@ Set a single custom expression variable.

int maxConcurrentConnectionsPerPool() const;
%Docstring
The maximum number of concurrent connections per connections pool
The maximum number of concurrent connections per connections pool.

.. note::

QGIS may in some situations allocate more than this amount
of connections to avoid deadlocks.

.. versionadded:: 3.4
%End
@@ -85,7 +85,7 @@
#include <cpl_conv.h> // for setting gdal options
#include <sqlite3.h>

#define CONN_POOL_MAX_CONCURRENT_CONNS 6
#define CONN_POOL_MAX_CONCURRENT_CONNS 4

QObject *ABISYM( QgsApplication::mFileOpenEventReceiver );
QStringList ABISYM( QgsApplication::mFileOpenEventList );
@@ -733,7 +733,10 @@ class CORE_EXPORT QgsApplication : public QApplication
static void setCustomVariable( const QString &name, const QVariant &value );

/**
* The maximum number of concurrent connections per connections pool
* The maximum number of concurrent connections per connections pool.
*
* \note QGIS may in some situations allocate more than this amount
* of connections to avoid deadlocks.
*
* \since QGIS 3.4
*/
@@ -31,6 +31,7 @@


#define CONN_POOL_EXPIRATION_TIME 60 // in seconds
#define CONN_POOL_SPARE_CONNECTIONS 2 // number of spare connections in case all the base connections are used but we have a nested request with the risk of a deadlock


/**
@@ -67,7 +68,7 @@ class QgsConnectionPoolGroup

QgsConnectionPoolGroup( const QString &ci )
: connInfo( ci )
, sem( QgsApplication::instance()->maxConcurrentConnectionsPerPool() )
, sem( QgsApplication::instance()->maxConcurrentConnectionsPerPool() + CONN_POOL_SPARE_CONNECTIONS )
{
}

0 comments on commit 0a0f84a

Please sign in to comment.
You can’t perform that action at this time.