memos/server/router/api/v1
Steven 8f29db2f49 fix(server): prevent memory exhaustion in thumbnail generation
Address high memory usage when opening resource tab (fixes #5183) by implementing:

1. Concurrency control: Limit thumbnail generation to 3 concurrent operations using semaphore to prevent memory exhaustion when many images are requested simultaneously

2. S3 optimization: Skip server-side thumbnail generation for S3-stored images by default. S3 images now use presigned URLs directly, avoiding:
   - Downloading large images from S3 into server memory
   - Decoding and resizing images on the server
   - High memory consumption during batch requests

3. Memory management improvements:
   - Explicitly clear blob and decoded image from memory after use
   - Restructure thumbnail cache check to avoid unnecessary semaphore acquisition
   - Double-check pattern to prevent duplicate generation while waiting

This restores the original S3 behavior before commit e4f6345 while maintaining thumbnail support for local/database storage.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 09:04:21 +08:00
..
test fix(api): correct user registration logic and first-user detection 2025-11-06 23:41:47 +08:00
acl.go chore: fix reactions seed data 2025-10-27 20:27:27 +08:00
acl_config.go chore: fix linter 2025-11-05 23:59:24 +08:00
activity_service.go chore: fix linter 2025-10-31 08:36:12 +08:00
attachment_service.go fix(server): prevent memory exhaustion in thumbnail generation 2025-11-07 09:04:21 +08:00
auth.go chore: fix reactions seed data 2025-10-27 20:27:27 +08:00
auth_service.go refactor: rename workspace to instance throughout codebase 2025-11-05 23:35:35 +08:00
auth_service_client_info_test.go chore: fix linter 2025-08-31 20:22:32 +08:00
common.go refactor: remove unused constants 2025-10-16 20:40:46 +08:00
health_service.go
idp_service.go fix(security): add missing authorization checks to various services (#5217) 2025-11-06 19:42:44 +08:00
instance_service.go refactor: rename workspace to instance throughout codebase 2025-11-05 23:35:35 +08:00
logger_interceptor.go chore: add a new LOG_STACKTRACES option (#4973) 2025-08-07 23:56:21 +08:00
memo_attachment_service.go fix(security): implement security review recommendations (#5228) 2025-11-06 23:32:27 +08:00
memo_relation_service.go fix(security): implement security review recommendations (#5228) 2025-11-06 23:32:27 +08:00
memo_service.go refactor: rename workspace to instance throughout codebase 2025-11-05 23:35:35 +08:00
memo_service_converter.go refactor: rename workspace to instance throughout codebase 2025-11-05 23:35:35 +08:00
memo_service_filter.go
reaction_service.go fix(security): implement security review recommendations (#5228) 2025-11-06 23:32:27 +08:00
resource_name.go refactor: rename workspace to instance throughout codebase 2025-11-05 23:35:35 +08:00
shortcut_service.go refactor: remove unused constants 2025-10-16 20:40:46 +08:00
test_auth.go
user_service.go fix(api): correct user registration logic and first-user detection 2025-11-06 23:41:47 +08:00
user_service_stats.go refactor: rename workspace to instance throughout codebase 2025-11-05 23:35:35 +08:00
v1.go fix(server): prevent memory exhaustion in thumbnail generation 2025-11-07 09:04:21 +08:00