[NEW] Display total number of files and total upload size in admin#13184
[NEW] Display total number of files and total upload size in admin#13184
Conversation
|
@sampaiodiego what do you think? is this query too heavy? I tried to lighten it as much as possible by only getting size field. I've ran similar query on open a few times and it didnt seem to cause any noticable load on db. But not sure how heavy it would be on Rocket.Chat. |
|
I guess it might be heavy if the server has too many files in both operations: fetching them all from mongo and iterating over them synchronously. what do you think using an aggregate here? need to test how heavy it is on mongo but it is for sure lighter on rocket.chat |
|
True... an aggregate that just did a sum would probably be no harder on the db then fetching all records. 🤔 I’ll try that and see how mongo treats it |
|
@sampaiodiego switched to aggregate. Tested out on on a 27Gig worth and returned in normal response time. So should be light enough |
Co-Authored-By: geekgonecrazy <[email protected]>
Co-Authored-By: geekgonecrazy <[email protected]>
…13184) * Display total number of files and total upload size in admin * Switch to aggregate * Switch to aggregate * Switch from await to promise.await Co-Authored-By: geekgonecrazy <[email protected]> * Remove async * Handle empty result Co-Authored-By: geekgonecrazy <[email protected]>
This adds number of uploads and how much storage those uploads are using to the admin screen: