Skip to content
Permalink
Browse files

Add QgsApplication::maxConcurrentConnectionsPerPool()

  • Loading branch information
m-kuhn committed Aug 3, 2018
1 parent 92ace51 commit 9d5f6f3f2e7f987d1add9c17e180197788e3359b
@@ -797,6 +797,13 @@ Do not include generated variables (like system name, user name etc.)
Set a single custom expression variable.

.. versionadded:: 3.0
%End

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

.. versionadded:: 3.4
%End

%If (ANDROID)
@@ -85,6 +85,8 @@
#include <cpl_conv.h> // for setting gdal options
#include <sqlite3.h>

#define CONN_POOL_MAX_CONCURRENT_CONNS 6

QObject *ABISYM( QgsApplication::mFileOpenEventReceiver );
QStringList ABISYM( QgsApplication::mFileOpenEventList );
QString ABISYM( QgsApplication::mPrefixPath );
@@ -1461,6 +1463,10 @@ void QgsApplication::setCustomVariable( const QString &name, const QVariant &val
emit instance()->customVariablesChanged();
}

int QgsApplication::maxConcurrentConnectionsPerPool() const
{
return CONN_POOL_MAX_CONCURRENT_CONNS;
}

QString QgsApplication::nullRepresentation()
{
@@ -732,6 +732,13 @@ class CORE_EXPORT QgsApplication : public QApplication
*/
static void setCustomVariable( const QString &name, const QVariant &value );

/**
* The maximum number of concurrent connections per connections pool
*
* \since QGIS 3.4
*/
int maxConcurrentConnectionsPerPool() const;

#ifdef SIP_RUN
SIP_IF_FEATURE( ANDROID )
//dummy method to workaround sip generation issue
@@ -19,6 +19,7 @@
#define SIP_NO_FILE

#include "qgis.h"
#include "qgsapplication.h"
#include <QCoreApplication>
#include <QMap>
#include <QMutex>
@@ -29,7 +30,6 @@
#include <QThread>


#define CONN_POOL_MAX_CONCURRENT_CONNS 6
#define CONN_POOL_EXPIRATION_TIME 60 // in seconds


@@ -59,8 +59,6 @@ class QgsConnectionPoolGroup
{
public:

static const int MAX_CONCURRENT_CONNECTIONS;

struct Item
{
T c;
@@ -69,7 +67,7 @@ class QgsConnectionPoolGroup

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

0 comments on commit 9d5f6f3

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