Skip to content

Commit 955323f

Browse files
committed
Add QgsApplication::maxConcurrentConnectionsPerPool()
1 parent bef52f3 commit 955323f

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

python/core/auto_generated/qgsapplication.sip.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,13 @@ Do not include generated variables (like system name, user name etc.)
797797
Set a single custom expression variable.
798798

799799
.. versionadded:: 3.0
800+
%End
801+
802+
int maxConcurrentConnectionsPerPool() const;
803+
%Docstring
804+
The maximum number of concurrent connections per connections pool
805+
806+
.. versionadded:: 3.4
800807
%End
801808

802809
%If (ANDROID)

src/core/qgsapplication.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@
8585
#include <cpl_conv.h> // for setting gdal options
8686
#include <sqlite3.h>
8787

88+
#define CONN_POOL_MAX_CONCURRENT_CONNS 6
89+
8890
QObject *ABISYM( QgsApplication::mFileOpenEventReceiver );
8991
QStringList ABISYM( QgsApplication::mFileOpenEventList );
9092
QString ABISYM( QgsApplication::mPrefixPath );
@@ -1461,6 +1463,10 @@ void QgsApplication::setCustomVariable( const QString &name, const QVariant &val
14611463
emit instance()->customVariablesChanged();
14621464
}
14631465

1466+
int QgsApplication::maxConcurrentConnectionsPerPool() const
1467+
{
1468+
return CONN_POOL_MAX_CONCURRENT_CONNS;
1469+
}
14641470

14651471
QString QgsApplication::nullRepresentation()
14661472
{

src/core/qgsapplication.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,13 @@ class CORE_EXPORT QgsApplication : public QApplication
732732
*/
733733
static void setCustomVariable( const QString &name, const QVariant &value );
734734

735+
/**
736+
* The maximum number of concurrent connections per connections pool
737+
*
738+
* \since QGIS 3.4
739+
*/
740+
int maxConcurrentConnectionsPerPool() const;
741+
735742
#ifdef SIP_RUN
736743
SIP_IF_FEATURE( ANDROID )
737744
//dummy method to workaround sip generation issue

src/core/qgsconnectionpool.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#define SIP_NO_FILE
2020

2121
#include "qgis.h"
22+
#include "qgsapplication.h"
2223
#include <QCoreApplication>
2324
#include <QMap>
2425
#include <QMutex>
@@ -29,7 +30,6 @@
2930
#include <QThread>
3031

3132

32-
#define CONN_POOL_MAX_CONCURRENT_CONNS 6
3333
#define CONN_POOL_EXPIRATION_TIME 60 // in seconds
3434

3535

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

62-
static const int MAX_CONCURRENT_CONNECTIONS;
63-
6462
struct Item
6563
{
6664
T c;
@@ -69,7 +67,7 @@ class QgsConnectionPoolGroup
6967

7068
QgsConnectionPoolGroup( const QString &ci )
7169
: connInfo( ci )
72-
, sem( CONN_POOL_MAX_CONCURRENT_CONNS )
70+
, sem( QgsApplication::instance()->maxConcurrentConnectionsPerPool() )
7371
{
7472
}
7573

0 commit comments

Comments
 (0)