Skip to content
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

When connecting github user, associate with tasks and comments #956

Merged
merged 2 commits into from
Sep 20, 2017

Conversation

begedin
Copy link
Contributor

@begedin begedin commented Sep 19, 2017

Closes #941, closes #942

This PR adds 2 additional steps to the connect process. One associates existing tasks with the newly connected user, while the other does the same with comments.

There is a decision to be made about the user previously associated with these. Should the record be deleted, or should something else be done with it?

That's something that can be done as a separate issue, however.

@begedin begedin changed the title 941 942 connect GitHub user to tasks comments When connecting github user, associate with tasks and comments Sep 19, 2017
@begedin begedin force-pushed the 941-942-connect-github-user-to-tasks-comments branch from 8449717 to 906e539 Compare September 19, 2017 12:29
@begedin begedin force-pushed the 941-942-connect-github-user-to-tasks-comments branch from 906e539 to c6a504d Compare September 19, 2017 12:45
@@ -50,6 +53,8 @@ defmodule CodeCorps.GitHub.User do
Multi.new
|> Multi.update(:user, changeset)
|> Multi.run(:installations, fn %{user: %User{} = user} -> user |> associate_installations() end)
|> Multi.run(:tasks, fn %{user: %User{} = user} -> user |> associate_tasks() end)
|> Multi.run(:comments, fn %{user: %User{} = user} -> user |> associate_comments() end)
Copy link
Contributor

Choose a reason for hiding this comment

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

I get why you chained more Multi.runs on here but I'm deeply concerned about the number of tasks/comments that we may be associating here. I had originally envisioned this process being fairly asynchronous and displaying to the user something to the effect of "your account is syncing with GitHub", even going so far as to be blocking.

This sync problem is going to be even larger when we sync large repos from GitHub to projects.

I know this adds some non-trivial complexity here. We could probably get away with this as a first pass, MVP and all. But this is something we should really circle back to, at the very least.

Copy link
Contributor

Choose a reason for hiding this comment

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

Reading that these are Repo.update_all the operation may not be too slow. We should still write down an issue to benchmark certainly.

Syncing projects does seem like a different beast. That we need an issue for.

@joshsmith
Copy link
Contributor

My review above can be considered a 👍 if my questions are a non-issue right now. This can be merged if so.

@begedin begedin merged commit a80c5d3 into develop Sep 20, 2017
@begedin begedin deleted the 941-942-connect-github-user-to-tasks-comments branch September 20, 2017 05:33
@joshsmith
Copy link
Contributor

Do you want to create an issue for project sync async?

@begedin
Copy link
Contributor Author

begedin commented Sep 20, 2017

Created #959

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When connecting user to github, associate comments When connecting user to github, associate tasks
2 participants