Skip to content

[#470] Resolve "record channel size and message volume upon destruction"

Closes #470 (closed)

context

  • we would like to test a hypothesis that large channels tend to have longer lifetimes (and learn a bit about how much they are used)
  • this MR augments the CHANNEL_DESTROYED event to record metadata to allow us to study this question:
    • (1) how many members did the channel have when destroyed? (admins + subscribers)
    • (2) how many messages had been sent on the channel when it was destroyed? (broadcast in/out, command in/out)
  • it will maintain the invariant that once destroyed, a channel's phone number is not known to our system

changes

data layer

  • add metadata jsonb field to events table/model
    • it expects either a json object with memberCount (int) and messageCount (models.messageCount) fields or an empty object
    • @mari NOTE: you can find documentation for how to query the metadata field in test/unit/db/event near the bottom of the test suite
  • return a joined channel with nested joined memberships and messageCounts in return value from #getMatureDestructionRequests (so they can be included as metadata when destruction requests are processed)
  • include metadata in calls from phoneNumberRepository#destroy to eventRepository#log
    • but omit the channelPhoneNumber field!

tooling side-effect

  • revert to using the same named volume for postgres data in dev and test docker stacks
  • (a prior commit had done the sensible thing of making the test stack use a different named volume, which would be fine if we were starting from scratch, but since this volume has no data to start with, it disrupts the dev env for folks who are in mid-flow for little value, so we abandon the change)

Merge request reports

Loading