Skip to content

Commit

Permalink
successive ThreadPoolExecutors for all zoom levels
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mash-graz authored and wonder-sk committed Dec 6, 2019
1 parent d969e41 commit 89f1640
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions python/plugins/processing/algs/qgis/TilesXYZ.py
Expand Up @@ -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):
Expand Down

0 comments on commit 89f1640

Please sign in to comment.