writeProtectionEvents appends the audit rows best-effort. Deterministic ids + ON CONFLICT DO NOTHING make an MTA-retried re-screen idempotent, so writing outside the message transaction is safe.
(ctx context.Context, messageID string, events []identity.ProtectionEvent)
| 161 | // ON CONFLICT DO NOTHING make an MTA-retried re-screen idempotent, so writing |
| 162 | // outside the message transaction is safe. |
| 163 | func (s *Server) writeProtectionEvents(ctx context.Context, messageID string, events []identity.ProtectionEvent) { |
| 164 | for _, ev := range events { |
| 165 | if err := s.store.CreateProtectionEvent(ctx, ev); err != nil { |
| 166 | log.Printf("[mail:%s] screening_event write failed (%s/%s): %v", messageID, ev.Source, ev.Reason, err) |
| 167 | } |
| 168 | } |
| 169 | } |
no test coverage detected