Skip to content

Commit

Permalink
Make nested iterator request test solid for max conn count changes
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Aug 3, 2018
1 parent 9d5f6f3 commit 56885e1
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tests/src/python/test_provider_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -1153,11 +1153,16 @@ def testConcurrency(self):
"""
vl = QgsVectorLayer('{conn} srid=4326 table="qgis_test".{table} (geom) sql='.format(conn=self.dbconn, table='someData'), "testgeom", "postgres")
self.assertTrue(vl.isValid())
it = vl.getFeatures()
it2 = vl.getFeatures()
it3 = vl.getFeatures()
it4 = vl.getFeatures()
QgsProject.instance().addMapLayer(vl)

# Acquire the maximum amount of concurrent connections
iterators = list()
for i in range(QgsApplication.instance().maxConcurrentConnectionsPerPool()):
iterators.append(vl.getFeatures())

# Run an expression that will also do a request and should use a spare
# connection. It just should not deadlock here.

feat = next(it)
context = QgsExpressionContext()
context.setFeature(feat)
Expand Down

0 comments on commit 56885e1

Please sign in to comment.