Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Remove trash collection from models when not used #26628

Merged
merged 2 commits into from
Aug 19, 2022

Conversation

sampaiodiego
Copy link
Member

Proposed changes (including videos or screenshots)

When a trashCollection is provided to a model, all removed records from that collection/model are also stored in the "trash collection", but this has a cost, every delete operation now has to perform a find before actually removing the records.

The issue is that very few places were actually fetching records from the trash collection.. So all this extra cost was actually wasted.

This PR removes the trashCollection from all models that are NOT performing a trashFind.

I can foresee immediate performance gain by removing the trash param from some collections with high amount of records removal like NotificationQueue, UsersSessions and Sessions .

Issue(s)

Steps to test or reproduce

Further comments

@sampaiodiego sampaiodiego requested review from a team August 19, 2022 15:13
@ggazzo ggazzo added stat: ready to merge PR tested and approved waiting for merge and removed stat: needs QA labels Aug 19, 2022
@codecov
Copy link

codecov bot commented Aug 19, 2022

Codecov Report

Merging #26628 (d6abe1c) into develop (bfbade5) will increase coverage by 0.14%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #26628      +/-   ##
===========================================
+ Coverage    38.57%   38.72%   +0.14%     
===========================================
  Files          758      758              
  Lines        18783    18783              
  Branches      1453     1453              
===========================================
+ Hits          7246     7273      +27     
+ Misses       11322    11293      -29     
- Partials       215      217       +2     
Flag Coverage Δ
e2e 38.72% <ø> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@kodiakhq kodiakhq bot merged commit 2b8db0d into develop Aug 19, 2022
@kodiakhq kodiakhq bot deleted the do-not-use-trash-collection branch August 19, 2022 18:12
@murtaza98 murtaza98 mentioned this pull request Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat: QA skipped stat: ready to merge PR tested and approved waiting for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants