Fix that a storage upload error would leave behind a stuck-pending ActionMailbox::InboundEmail that could never be processed. The message isn't lost: the SMTP relay sees an HTTP server error and defers message delivery. We just have spurious, non-actionable InboundEmails stuck pending and tripping monitoring.
This does still leave behind an unattached ActiveStorage::Blob with no corresponding object on the storage service, but that's less annoying.
Permit applications to hack in custom DB config for ActionMailbox::InboundEmail until Action Mailbox has first-class multi-DB support:
ActiveSupport.on_load(:action_mailbox_record) do
connects_to reading: :action_mailbox_replica, writing: :action_mailbox_primary
end
This also adds a new column, message_checksum, to the action_mailbox_inbound_emails table
for storing SHA1 digest of the email source. Additionally, it makes generating the missing
message id deterministic and adds a unique index on message_checksum and message_id to
detect duplicate emails.
```
rails/actionmailbox$ bundle exec rake tests
(snip)
...
rails/activerecord/lib/active_record/persistence.rb:48: warning: in `create!':
the last argument was passed as a single Hash
rails/actionmailbox/app/models/action_mailbox/inbound_email/message_id.rb:21:
warning: although a splat keyword arguments here
...
(snip)
```