Skip to content
Permalink
Browse files

Make nested iterator request test solid for max conn count changes

  • Loading branch information
m-kuhn committed Aug 3, 2018
1 parent 9d5f6f3 commit 56885e19aa3a4b72b9d4b5fb4dae115813fcc47e
Showing with 9 additions and 4 deletions.
  1. +9 −4 tests/src/python/test_provider_postgres.py
@@ -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)

0 comments on commit 56885e1

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