mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Optimized collating members and email IDs
- using lodash to do this is unnecessarily heavy, so this commit switches the code to the equivalent native version - as mentioned in the comment I added, I think we can further optimize this by storing it as a Set and then calling `Array.from` once, but that's a step too far for now
This commit is contained in:
parent
44edf3d379
commit
18adf4b000
1 changed files with 3 additions and 4 deletions
|
@ -1,5 +1,3 @@
|
|||
const _ = require('lodash');
|
||||
|
||||
class EventProcessingResult {
|
||||
/**
|
||||
* @param {object} result
|
||||
|
@ -59,8 +57,9 @@ class EventProcessingResult {
|
|||
|
||||
this.processingFailures += other.processingFailures || 0;
|
||||
|
||||
this.emailIds = _.compact(_.union(this.emailIds, other.emailIds || []));
|
||||
this.memberIds = _.compact(_.union(this.memberIds, other.memberIds || []));
|
||||
// TODO: come up with a cleaner way to merge these without churning through Array and Set
|
||||
this.emailIds = Array.from(new Set([...this.emailIds, ...(other.emailIds || [])])).filter(Boolean);
|
||||
this.memberIds = Array.from(new Set([...this.memberIds, ...(other.memberIds || [])])).filter(Boolean);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue