Repository navigation
Count attachments and use the accept time when recording receive usage - #50
Merged
Merged
Conversation
fmsgd recorded a received message's usage with only its body's wire size and the sender's timestamp, so attachments were never counted and a backdated message fell outside the per-day window. Usage is now the stored size, the body plus every attachment, each decompressed if it was sent compressed. It's timestamped when this host accepted the message. The receive limit check uses the same stored size, so a message whose attachments take a recipient over a limit is rejected with 101 (user full), as one with a large body already was. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
fmsgd recorded a received message's usage (
POST /fmsgid/recv) with only the body's wire size and the sender's timestamp. Attachments were never counted, and a backdated message fell outside fmsgid's per-day window.storedSize).recordRecvUsage).recvLimitExceeded: messages per day, bytes per day, total bytes;-1is unlimited) uses that same stored size. So a message whose attachments take a recipient over a limit is rejected with101(user full), as one with a large body already was. The check is otherwise unchanged.Tests
usage_test.go: stored size (compressed body and attachments), every limit's boundaries, a message whose attachments go over a limit its body alone fits, and the recorded usage payload (accept time, stored size, one record per accepted recipient) against a stub fmsgid.go vet ./...,gofmtclean, andgo test ./...pass, including thepkg/messagePostgreSQL integration tests against a throwaway Postgres 17.Deploy
No schema change. Deploy before or with fmsg-webapi's quota change.
🤖 Generated with Claude Code