nyaruka / mailroom

Backend services for the TextIt platform.
Other
0 stars 1 forks source link

Add cron to fail old messages #273

Open rowanseymour opened 2 weeks ago

rowanseymour commented 2 weeks ago

And remove them from the redis queues. Would replace fail_old_messages in RP that doesn't do that.

rowanseymour commented 1 week ago

Maybe tho... this belongs in courier since 1) we can pop old messages out of redis without querying against the db 2) courier has the functionality for batch updates of message statuses.

Mailroom might still be responsible for Android messages.

norkans7 commented 1 week ago

we check the created on date is not older than a week ago, and to avoid breaking the resend feature we also check the nextAttempt field is not set or is also older than a week ago?

rowanseymour commented 1 week ago

I don't think we have to worry about resending. If a message is in a courier queue, then it should be status Q or E and users can't request to resend those.. and it doesn't matter if next_attempt is set.. if it's 7 days old we fail it.

norkans7 commented 1 week ago

I think the first time a message is queued next_attempt is not set (set to epoch time) so that would skip all those messages so that is why I think we need to use a combination of created_on and next_attempt logic

rowanseymour commented 1 week ago

Ah I think we should find messages that are too old by looking at their score timestamp in the channel queue in Redis.. we wouldn't be querying from the database.