auto-cull stale channels
value
- under heavy load (and absent a signald replacement), supporting lots of unused channels unnecessarily increases the memory footprint of each signald shard (specifically: each container uses ~2GB in RAM likely due to the size of the in-memory jackson keystore)
- while we work to achieve a better persistence solution that would shrink this footrpint in
signalc
, we would like to mitigate the degredation to system performance caused by this situation - SO: let's create a daily job that automatically deletes all channels that haven't been used in over a month (using some of our existing work on
recycle stale channels
command to do this! - this decreases system load and also protects our user's privacy by deleting unneeded metadata!
behavior
automated deltion
WHEN signalboost boots up (guaranteed to happen at least every day)
- THEN a job will run that finds every channel that has not been used in over a month and create a
deletionRequest
for it - AND THEN the admins of the channel will receive a message warning them that their channel will be completely deleted if they don't use it in a day. (see #215 (closed) for details)
GIVEN a pending deletion request for channel +1222333444
- WHEN a channel admin uses the channel within 24 hours of the deletion job's creation
- THEN channel admins and maintainers will receive a notification that the channel has been redeemed (see #215 (closed) and #347 (closed) for details)
- AND THEN the channel will not be deleted and the deletion request will be destroyed
GIVEN a pending deletion request for channel +12223334444
- WHEN 24 hours elapse and the admins take no action
- THEN all channel admins and subscribers will receive a notification that says
This channel and all data associated with it have been permanently deleted due to lack of use. To create a new channel, visit https://signalboost.info
cli deletion
GIVEN a channel with phone number +12223334444
- WHEN a maintainer enters
boost destroy +12223334444
- THEN a deletion request for +12223334444 will be created (and notifications sent out as described above)
- AND THEN the maintainer will receive a message that says
Channel +1222333444 has been scheduled for deletion in 24 hours.
GIVEN a channel with phone number +12223334444
- WHEN a maintainer enters
boost recycle +12223334444
then nothing will happe
sad path (cli)
WHEN a db error occurs during deltion
- THEN all operations will be rolled back
- AND THEN the maintainer will receive a message notifying them they should try again
implementation
- add a job that looks up channels with a
messageCount
that has not been updated in over a month - modify the
requestToRecycle
code to becomerequestToDestroy
:- data model: migrations/model updates to rename
recycleRequests
todestructionRequests
, etc. - strings: update all keys referring to
recycleRequest___
to refer todestructinRequests
- logic: modify
registrar.phoneNumber.processRecycleRequests
to callregistrar.phoneNumber.destroy
on line 51 (instead of callingphoneNumber.recycle
- shuffle the file structure a bit so
destructionRequest
lives withphoneNumber.destroy
module
- data model: migrations/model updates to rename