Skip to content

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

Merged
kodiakhq[bot] merged 2 commits into
developfrom
do-not-use-trash-collection
Aug 19, 2022
Merged

kodiakhq[bot] merged 2 commits into
developfrom
do-not-use-trash-collection

Conversation

@sampaiodiego

Copy link
Copy Markdown
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

codecov Bot commented Aug 19, 2022 •

Copy link
Copy Markdown

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: 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