Skip to content
Permalink
Browse files

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.

(cherry picked from commit 89f1640)
  • Loading branch information
mash-graz authored and nyalldawson committed Oct 30, 2019
1 parent e156b03 commit e6ef22627575ab5f33d4dcd29ae6f8f3e2fa6074
Showing with 4 additions and 3 deletions.
  1. +4 −3 python/plugins/processing/algs/qgis/TilesXYZ.py
@@ -305,9 +305,10 @@ def generate(self, writer, parameters, context, feedback):
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):

0 comments on commit e6ef226

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