Low-priority fixes (v2.2.2)#16
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three internal bug fixes addressing config wiring, async correctness, and graceful shutdown. No new features or breaking API changes.
Changes
1. Wire
IMG_THUMBNAIL_MAX_SIZEto the image processorIMG_THUMBNAIL_MAX_SIZEwas defined in config but never consumed — thumbnails always used the hardcoded(256, 256)default. Now:PillowImageProcessoracceptsthumbnail_max_sizein its constructor and uses it as the default forgenerate_thumbnail.settings.thumbnail_max_sizeand passes it through.max_size: tuple[int, int] | None = Noneso implementations control their own defaults.Files: image_processor.py, pillow_processor.py, dependencies.py
2. Replace
threading.Lockwithasyncio.Lockin cacheInMemoryImageCacheusedthreading.Lock, which blocks the event loop under concurrent async access. All cache methods (get,set,invalidate,clear) are nowasyncwithasyncio.Lock.CachedImageRepositoryupdated toawaitall cache calls.Files: in_memory_cache.py, cached_image_repository.py
3. Async executor shutdown with timeout
ProcessPoolExecutor.shutdown(wait=True)was called synchronously in the lifespan, blocking the event loop indefinitely if workers hung. Newasync_shutdown_executor()runs the shutdown in a thread with a 30-second timeout, then force-cancels remaining workers viashutdown(wait=False, cancel_futures=True).Files: pillow_processor.py, main.py
Test changes
asyncio.gather.async_shutdown_executorinstead ofshutdown_executor.Checklist
ruff check— all passedmypy src/— no issues (52 source files)pytest— 216 passed2.2.1→2.2.2(PATCH — bug fixes only)