s3: fix pathCache race condition

Make sure pathCache is properly locked for concurrent access.

Add RWMutex to the PublishedStorage struct:
- Cache initialization
  Read-lock to test for nil, then write-lock with a second nil check before populating
- Cache reads
  RLock/RUnlock, allowing concurrent readers
- Cache writes / deletes
  Lock/Unlock
This commit is contained in:
André Roth
2026-06-19 12:02:07 +02:00
parent c0c4bc3e35
commit c63324756b
2 changed files with 33 additions and 9 deletions
+2 -1
View File
@@ -14,7 +14,8 @@ import (
// @Router /api/s3 [get]
func apiS3List(c *gin.Context) {
keys := []string{}
for k := range context.Config().S3PublishRoots {
s3Roots := context.Config().S3PublishRoots
for k := range s3Roots {
keys = append(keys, k)
}
c.JSON(200, keys)