From 0df9d31ad78880926dd6d0a495b75e0c7486ecee Mon Sep 17 00:00:00 2001 From: David Manthey Date: Mon, 20 May 2024 08:42:09 -0400 Subject: [PATCH] Thumbnail generation jobs are less blocking When running a job via the PUT large_image/thumbnails endpoint, run it as an independent thread so other local asynchronous jobs are not delayed. --- CHANGELOG.md | 1 + girder/girder_large_image/rest/large_image_resource.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fcc954875..699fc5001 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Changes - Log more when saving annotations ([#1525](../../pull/1525)) +- Thumbnail generation jobs are less blocking ([#1528](../../pull/1528)) ## 1.28.2 diff --git a/girder/girder_large_image/rest/large_image_resource.py b/girder/girder_large_image/rest/large_image_resource.py index 9a5a088b9..447733cf9 100644 --- a/girder/girder_large_image/rest/large_image_resource.py +++ b/girder/girder_large_image/rest/large_image_resource.py @@ -22,6 +22,7 @@ import pprint import re import shutil +import threading import time import cherrypy @@ -117,6 +118,11 @@ def cursorNextOrNone(cursor): def createThumbnailsJob(job): + thread = threading.Thread(target=createThumbnailsJobThread, args=(job, ), daemon=True) + thread.start() + + +def createThumbnailsJobThread(job): """ Create thumbnails for all of the large image items.