-
Notifications
You must be signed in to change notification settings - Fork 37
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
fix n+1 problem for zoom account availability #82
fix n+1 problem for zoom account availability #82
Conversation
a2b6ade
to
ea4ff45
Compare
@prabalsingh24 you need to add separate loader for Resource.availability. |
api/routes/graphql/index.js
Outdated
loaders: { | ||
zoomAccountAvailabilityLoader: ZoomAccount.getAvailabilityLoader(), | ||
}, |
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.
or do you mean to add a different loader here.
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.
zoomAccountResourceLoader
something like this?
api/services/ZoomAccount/index.js
Outdated
}, | ||
...utilizedResourceClause(args.dateTimeRange, args.options), | ||
}).then((accounts) => | ||
keys.map((key) => !accounts.find((account) => key.id === account.id)), |
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.
can't compare just based on id. Need to do deep equate for the whole key.
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.
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.
key : {
id: 28,
dateTimeRange: {
start_at: '2020-05-20T18:30:00.000Z',
end_at: '2020-05-20T19:30:00.000Z'
}
}
zoomAccount : {
id: 28,
email: '[email protected]',
created_at: 2020-05-21T06:45:50.203Z,
updated_at: 2020-05-21T06:45:50.203Z
}
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 can do deep equate here?
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.
You also get ZoomAccount.resource having start_at and end_at. Form the same shape with the data from db and then equate them.
api/services/ZoomAccount/index.js
Outdated
ifAvailableDuring(dateTimeRange, options) { | ||
return ZoomAccount.findAvailaibilityDuring( | ||
this.instance.id, | ||
dateTimeRange, | ||
options, | ||
); |
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.
No need to change this.
Please update your branch with master. |
f53a19b
to
8881a31
Compare
I have few doubts. I've replied in above comments :) |
api/services/ZoomAccount/index.js
Outdated
}, | ||
...utilizedResourceClause(args.dateTimeRange, args.options), | ||
}).then((accounts) => | ||
keys.map((key) => !accounts.find((account) => key.id === account.id)), |
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.
You also get ZoomAccount.resource having start_at and end_at. Form the same shape with the data from db and then equate them.
@prabalsingh24 what is the status on this? |
Sir can we discuss this over a call once? |
e4aa6ad
to
c2f31c0
Compare
75974dd
to
2e4bc08
Compare
I've made the changes and it is working too. Have a look whenever you're free :) Sorry I was little slow in doing this, I had my end semester exams |
); | ||
}; | ||
|
||
equateKeyAndInvite({ id, excludedEvents = [], dateTimeRange }, account) { |
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.
You are not equating key to invite here. Fix the name.
Looks good. Just minor change request. |
Congratualtions @prabalsingh24, your pull request is merged! 🎉 Thanks for your contributions and participating in BOSS 2020. 🙌 You can claim your bounty points here. 💰 |
fixes #18