successive ThreadPoolExecutors for all zoom levels

instead of using only one ThreadPoolExecutor for all MetaTiles, its now handled in a loop and new ThreadPools for the next zoom level will be started when all work for the previous one is already done. i guess, this will fix the issues and interferences described in #32471 and shouldn't be much slower.
This commit is contained in:
mash-graz 2019-10-30 01:10:39 +01:00 committed by Martin Dobias
parent d969e41799
commit 89f1640419

View File

@ -305,9 +305,10 @@ class TilesXYZAlgorithmBase(QgisAlgorithm):
self.progressThreadLock = threading.Lock()
if self.maxThreads > 1:
feedback.pushConsoleInfo(self.tr('Using {max_threads} CPU Threads:').format(max_threads=self.maxThreads))
feedback.pushConsoleInfo(self.tr('Pushing all tiles at once: {meta_count} tiles.').format(meta_count=len(allMetatiles)))
with ThreadPoolExecutor(max_workers=self.maxThreads) as threadPool:
threadPool.map(self.renderSingleMetatile, allMetatiles)
for zoom in range(self.min_zoom, self.max_zoom + 1):
feedback.pushConsoleInfo(self.tr('Generating tiles for zoom level: {zoom}').format(zoom=zoom))
with ThreadPoolExecutor(max_workers=self.maxThreads) as threadPool:
threadPool.map(self.renderSingleMetatile, metatiles_by_zoom[zoom])
else:
feedback.pushConsoleInfo(self.tr('Using 1 CPU Thread:'))
for zoom in range(self.min_zoom, self.max_zoom + 1):