Граф коммитов

4 Коммитов

Автор SHA1 Сообщение Дата
Phil Booth 3b32fe021b
refactor(bounces): pull all bounce/complaint code into one module
This change does two things:

1. The old `BounceRecord`, `BounceType` and `BounceSubtype` types are
   removed from the `auth_db` module into `bounces`, so that they can
   more easily be re-used when writing bounce/complaint data to Redis.

2. Those types are renamed to `DeliveryProblem`, `ProblemType` and
   `ProblemSubtype` respectively, and the `bounces` module is renamed to
   `delivery_problems`. That may seem weird at first, but I have good
   reason for it and am open to alternative names if anyone can suggest
   something better.

   Historically we've always treated complaints as a type of bounce
   event, but that's inaccurate because bounces are never preceded by a
   delivery event whereas complaints are always preceded by one. This
   has caught me out in the past when analysing metrics and expecting a
   blanket sum of `deliveries + bounces = sends` to be true. It isn't.
   It's only true if you filter complaints from bounces before
   calculating the sum.

   Because of that, I wanted some different nomenclature that didn't use
   "bounces" as an umbrella term for "bounces and complaints". It won't
   affect the names we use in the metrics but I think it's important for
   language we use in the codebase to be as precise as possible. Things
   like "delivery error" or "delivery failure" also seemed inaccurate
   for the same reason; a complaint implies that the actual delivery
   succeeded. Hence "delivery problems", which seems generic enough to
   legitimately include both event types.
2018-10-16 07:06:12 +01:00
Phil Booth 31da83bb39
feat(db): serialize to JSON on write and deserialize from JSON on read
Previously, our Redis abstraction only worked with strings because it
only dealt with the somewhat nebulous concept of message metadata. Now
that we also want to use it for concrete types, it makes sense to bake
in automatic serialization from and deserialization to those types. This
frees consumers from the responsibility of having to serialize to a
Redis-friendly format manually.

This change achieves that aim by making the db methods generic. `db.set`
gets a type parameter that is `Serialize` and the getters get one that
is `DeserializeOwned`.
2018-10-06 13:52:31 +01:00
Phil Booth a644d18ca5
refactor(redis): extract redis code to a dedicated db module 2018-10-04 07:26:53 +01:00
Beatriz Rizental 482f69cebf feat(docs): document errors and errno 2018-08-24 13:24:51 -07:00