11/14/2020 (Sat) 17:56:11
>>11374>The timeout error is because of the shitty MongoDB
Well known services such as the ELK stack makes use of MongoDB and don't run into these kinds of issues.
If it's because queries take a long time to execute, have you considered using indices?
Also, auto-refreshing a thread causes the site to fetch the entire thread, yet the front-end code only considers "new" posts. You could consider extending the endpoint to take query parameters, then make use the $slice projection operator; https://docs.mongodb.com/manual/reference/operator/projection/slice/
If there's an index on each thread ID, then this would allow fetching new posts very quickly, and may lower the load.
Of course, this implies each thread contains an array of post documents.