rubyforgood / Flaredown

Flaredown web app and API
http://www.flaredown.com
GNU General Public License v3.0
39 stars 15 forks source link

Chat/discussion feature is broken #480

Closed bklang closed 3 years ago

bklang commented 3 years ago

The loading icon (see attached) appears forever. We should either fix or hide this feature. Screen Shot 2021-10-12 at 2 09 06 PM

bklang commented 3 years ago

The PR addressed code issues (likely introduced by our recent upgrade work), but the chat feature still does not work in staging. The reason is that the tier of MongoDB to which we subscribe does not allow the mapReduce feature. You can see this in the API response: [8000:AtlasError]: CMD_NOT_ALLOWED: mapReduce (on 2flaredown-staging-lind-shard-00-02.ql1v6.mongodb.net:27017). The restriction is mentioned in the MongoDB service documentation

I can think of two options at the moment:

benlangfeld commented 3 years ago

The PR addressed code issues (likely introduced by our recent upgrade work), but the chat feature still does not work in staging. The reason is that the tier of MongoDB to which we subscribe does not allow the mapReduce feature. You can see this in the API response: [8000:AtlasError]: CMD_NOT_ALLOWED: mapReduce (on 2flaredown-staging-lind-shard-00-02.ql1v6.mongodb.net:27017). The restriction is mentioned in the MongoDB service documentation

I can think of two options at the moment:

  • Upgrade to at least an M10 instance with MongoDB, which would cost somewhere around $60/mo
  • Refactor the queries to avoid mapReduce. This happens in two places right now.

You know, I'd love to know why we're using Mongo for this rather than Postgres. I havn't looked into it, so from the code it might be obvious, but it should probably be mentioned at a high level in the readme. There's a chance that what feels like it should be relational data could be much more performantly handled in a relational database.

We should at least be careful not to pull huge computations into the Rails process and blow out memory consumption there.