Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Conversation

@brianlovin
Copy link
Contributor

@brianlovin brianlovin commented Oct 1, 2018

Status

  • WIP
  • Ready for review
  • Needs testing

Deploy after merge (delete what needn't be deployed)

  • api

Run database migrations (delete if no migration was added)
YES

This is ready for review @mxstbr :)


return {
count: await getMemberCount(id),
count: memberCount || 1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should fallback to await getMemberCount(id) just to make sure?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels hacky, as though we don't trust the migration or the logic in the code to keep this right. Wdyt? Even having the || 1 feels brittle, but is a worst-case fallback right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah but why not make the worst-case correct-but-slow instead of completely-wrong-but-fast? Don't quite understand what the downside is there

Copy link
Contributor Author

@brianlovin brianlovin Oct 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just feels like this is going to be confusing to us in the future: "why does this one specific resolver fall back from an object field to a full db query?"

Just seems like we're overdoing this resolver with code that feels overly specific and will be confusing to maintain in the future. Technically it's not bad, but we'd also want to know if it ever had to run the fallback code right? That would mean we have bad db data

return {
threads: threads ? threads.reduction : 0,
members: members ? members.reduction : 0,
members: memberCount || 1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably fallback to loaders.channelMemberCount.load just to make sure?

@brianlovin
Copy link
Contributor Author

Kk @mxstbr I copied over your logic for the fallback. This PR is ready for another thorough review :)

mxstbr
mxstbr previously approved these changes Oct 4, 2018
Copy link
Contributor

@mxstbr mxstbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

Copy link
Contributor

@mxstbr mxstbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shipping to alpha!

@mxstbr mxstbr merged commit afaf376 into alpha Oct 4, 2018
@mxstbr mxstbr deleted the denormalize-member-counts branch October 4, 2018 09:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants