Closed agarzola closed 6 years ago
Need to add migrations to the deployment script.
Gotta get this through next hacknight, srsly.
Also, we need to look into running the pm2 config as a service so that service interruptions don’t require a manual restart.
All looks good to me :+1:. I'm not a node expert by any stretch, but it looks like you are handling errors, bulding queries sanely, all that jazz. Merge that ish.
This PR implements two standalone cron jobs and one new endpoint in the Express server. It also establishes a sqlite3 database, with an interface via
knex.js
.Notify channels job
Finds all unarchived channels with no activity in the past 30 days and:
purge_queue
tablePurge channels job
Finds all records in the
purge_queue
table and:channel_id
valuepurge_queue
tableCancel channel purge endpoint
Purge notification messages are interactive. They have a Don’t Archive button which, when clicked, triggers a
POST
request to this endpoint, which finds any records with the relevant channel’s ID in thepurge_queue
table and deletes them. If successful, the message is updated to reflect the fact that the channel is no longer in the purge queue, and unpins it. If unsuccessful, it returns a500
status, which leaves the message intact and results in an ephemeral error message that only the user who clicked on the button can see.