-
Notifications
You must be signed in to change notification settings - Fork 9
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
[MEX-527] Refactor pair filtering #1536
base: MEX-527-bulk-getters
Are you sure you want to change the base?
Conversation
- update PairFilteringService to work with pair models with the fields already populated (functional service) - update PairMetadataBuilder to use the functional filtering service - update pair methods (regular and filtered) in router service to use the builder - remove duplicate code in router service
this.pairs.map((pair) => pair.address), | ||
); | ||
|
||
this.pairs.forEach( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it wouldn't make a much difference here, but for a high number of iterations, forEach
is the least efficient way of ranging:
this.filters, | ||
this.pairsMetadata, | ||
this.pairs, | ||
); | ||
return this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these filters from PairsMetadataBuilder
should return the actual filtered pairs, not an instance of the class
this.pairsMetadata = pairsMetadata; | ||
this.filters = filters; | ||
this.filteringService = filteringService; | ||
constructor(pairService: PairService, pairCompute: PairComputeService) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can inject all the services in the constructor and also inject the builder class where it is used
|
||
pairsMetadata = await builder.build(); | ||
let pairs = builder.build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need it anymore after the changes on the filtering methods
Reasoning
Proposed Changes
PairFilteringService
to work with pair models with the fields already populated (functional service)PairMetadataBuilder
to use the functional filtering serviceHow to test