DoSomethingArchive / gambit-content

:black_joker: Content API for Gambit
MIT License
2 stars 5 forks source link

Investigate why campaign status wasn't updated #764

Closed itsjoekent closed 7 years ago

itsjoekent commented 7 years ago
screen shot 2016-12-01 at 1 09 10 pm
aaronschachter commented 7 years ago

This is likely an order of operations issue. If we're closing a Campaign and we remove the Campaign ID from CAMPAIGNBOT_CAMPAIGNS while its status is Active -- that Campaign status will never be updated to closed on app start.

One idea to resolve is to change loadCampaigns to just update the cache for all Campaigns we have documents for.

@deadlybutter Can you update issue description with actual text? The screenshots of Slack rooms won't help surface this issue when searching.

aaronschachter commented 7 years ago

I've pondering using campaigns.findById every time we need to load a Campaign instead of keeping them in memory on app start -- deprecating the CAMPAIGNBOT_CAMPAIGNS config variable altogether in favor of a new campaignbot boolean property on the Campaign model that admins can use to enable/disable CampaignBot campaigns. This would avoid needing to restart the app to turn campaigns on/off... although it would slow things down. We load keywords all in memory too -- which would be another Mongo query to execute if a keyword parameter is passed in an incoming chatbot request.

itsjoekent commented 7 years ago

+1 to loading from DB instead of memory where possible

aaronschachter commented 7 years ago

Closing this, as the investigation is done. This will be fixed when #775 is resolved.