Backups Refactoring
Motivation: this code has morphed into something almost indecipherable and is commonly observed as failing in tests (why??). Breaking it down into easier to test pieces will alleviate this.
It does not seem necessary to have a complex processing pipeline using a Task and a receive loop or to express several different states for the backup. Either the backup was completed+uploaded successfully (processed) or not.
- admins can still issue backups regardless of the per-user backup limit configuration
- some generic code was moved out of the Worker into the Backup module
- function renaming, docs, @specs to make it easier to follow
- :processed_count and :state are gone
- :tempdir is added so we do not need to pass that value around, and can aid debugging if backups are not getting uploaded correctly and you want to know where the tempfiles were
- doesn't matter if admin or user initiated the backup; user gets the same email regardless. the admin that did it can be found in the admin moderation log.
Works but tests need to be refactored now.
Edited by feld