Skip to content

[NEW] Display total number of files and total upload size in admin#13184

Merged
rodrigok merged 7 commits intodevelopfrom
add-storage-usage
Jan 19, 2019
Merged

[NEW] Display total number of files and total upload size in admin#13184
rodrigok merged 7 commits intodevelopfrom
add-storage-usage

Conversation

@geekgonecrazy
Copy link
Copy Markdown
Contributor

This adds number of uploads and how much storage those uploads are using to the admin screen:

image

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-13184 January 18, 2019 01:05 Inactive
@geekgonecrazy
Copy link
Copy Markdown
Contributor Author

@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.

@sampaiodiego
Copy link
Copy Markdown
Member

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

@geekgonecrazy
Copy link
Copy Markdown
Contributor Author

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

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-13184 January 18, 2019 21:20 Inactive
@geekgonecrazy
Copy link
Copy Markdown
Contributor Author

@sampaiodiego switched to aggregate. Tested out on on a 27Gig worth and returned in normal response time. So should be light enough

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-13184 January 18, 2019 21:47 Inactive
@geekgonecrazy geekgonecrazy added this to the 0.74.0 milestone Jan 18, 2019
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-13184 January 19, 2019 03:11 Inactive
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-13184 January 19, 2019 03:13 Inactive
Co-Authored-By: geekgonecrazy <[email protected]>
@rodrigok rodrigok merged commit 2372a47 into develop Jan 19, 2019
@rodrigok rodrigok deleted the add-storage-usage branch January 19, 2019 17:12
alansikora pushed a commit that referenced this pull request Jan 23, 2019
…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]>
@sampaiodiego sampaiodiego mentioned this pull request Jan 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants