diff --git a/attachment/store.go b/attachment/store.go index 8059a0cf..ba2e22cc 100644 --- a/attachment/store.go +++ b/attachment/store.go @@ -162,7 +162,7 @@ func (c *Store) sync() error { sizes[obj.ID] = obj.Size } } - log.Tag(tagStore).Debug("Attachment cache size updated to %s", util.FormatSizeHuman(size)) + log.Tag(tagStore).Debug("Attachment store updated: %d attachment(s), %s", len(localIDs), util.FormatSizeHuman(size)) c.mu.Lock() c.size = size c.sizes = sizes diff --git a/docs/config.md b/docs/config.md index edfa43ff..853d4891 100644 --- a/docs/config.md +++ b/docs/config.md @@ -547,6 +547,11 @@ When `endpoint` is specified, path-style addressing is enabled automatically (us attachment-cache-dir: "s3://AKID:SECRET@my-bucket/attachments?region=us-east-1&endpoint=https://s3.example.com" ``` +**Cleanup behavior:** A background sync runs every 15 minutes to reconcile the S3 bucket (or configured prefix) with +the server's message database. Objects whose keys match attachment file IDs that are no longer referenced in the database +(and are older than 1 hour) are automatically deleted. This also cleans up incomplete S3 multipart uploads that were +abandoned due to interrupted or failed attachment uploads. + Please also refer to the [rate limiting](#rate-limiting) settings below, specifically `visitor-attachment-total-size-limit` and `visitor-attachment-daily-bandwidth-limit`. Setting these conservatively is necessary to avoid abuse.