-
Notifications
You must be signed in to change notification settings - Fork 86
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
When connecting github user, associate with tasks and comments #956
Conversation
8449717
to
906e539
Compare
906e539
to
c6a504d
Compare
@@ -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) |
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 get why you chained more Multi.run
s 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.
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.
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.
My review above can be considered a 👍 if my questions are a non-issue right now. This can be merged if so. |
Do you want to create an issue for project sync async? |
Created #959 |
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.