FoxxMD / context-mod

an event-based, reddit moderation bot built on top of snoowrap and written in typescript
https://contextmod.dev
MIT License
49 stars 11 forks source link

Retriving delayed actions hydrated from DB after init causes api calls to reddit #137

Open FoxxMD opened 1 year ago

FoxxMD commented 1 year ago

Delayed action entities do not store all of the associated activity's data (and don't use the existing Activity entity).

When a user visits the dashboard of a newly-started CM instances that has hydrated actions from the DB CM serializes some of the activity info including permalink which is NOT stored in the db. Subsequently, accessing this property causes snoowrap to causes a full fetch for each activity. This drastically impacts CM api usage and performance:

Solution for this is using existing Activity entity to store dispatched activity info. #136 is a partial implementation for this which also checks that Activities associated with existing Check/Run results isn't deleted after the delayed activity is run.