Fix 500 server error on project dashboard by rmunn · Pull Request #1779 · sillsdev/web-languageforge

@rmunn

Large projects were returning an HTTP 500 on the project dashboard,
because PHP was running out of memory trying to return every entry for
stats to be calculated client-side. This changes the stats to be
calculated server-side instead. We get rid of the "number of entries
with audio" stat because it's not possible to calculate in a simple
Mongo query and would require serializing the entire entry database
server-side, causing the very memory error we're trying to get rid of.

@rmunn added the bug

An existing problem with our app in production

label

Sep 25, 2023

hahn-kev

@rmunn

Now the lex_stats call opens a single MongoDB connection and reuses it
for all three queries. The efficiency boost might be minor, but it's
also a slight code simplification so it's just as well to do it now.

@rmunn rmunn deleted the bugfix/dashboard-500 branch

September 28, 2023 02:36