-
Notifications
You must be signed in to change notification settings - Fork 80
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
Store assigned PRs in memory #1906
base: master
Are you sure you want to change the base?
Conversation
1a93fe6
to
3fde3dd
Compare
3fde3dd
to
d64caa6
Compare
Rebased. |
@@ -348,4 +349,7 @@ pub struct Context { | |||
pub db: crate::db::ClientPool, | |||
pub username: String, | |||
pub octocrab: Octocrab, | |||
/// Represents the workqueue (assigned open PRs) of individual reviewers. | |||
/// tokio's RwLock is used to avoid deadlocks, since we run on a single-threaded tokio runtime. | |||
pub workqueue: Arc<tokio::sync::RwLock<ReviewerWorkqueue>>, |
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.
So, I don't quite like storing this state like this - I'd rather have some (Handler, HandlerState)
somewhere. But this is fine for now.
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.
The problem is that this state has to be available across handlers. It is populated in pull_requests_assignment_update.rs
, updated in pr_tracking.rs
and it will be read in the future in assign.rs
. Thus it's pretty much global state, hence it being stored in Context
.
// .await?; | ||
// return Ok(()); | ||
} | ||
// let work_queue = has_user_capacity(&db_client, &name).await; |
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.
Why is this disabled? We definitely want this logging.
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.
These functions that I commented were using the assigned_prs
column in the DB, which is no longer used after this PR. So these functions simply do not work anymore (in fact I removed them in this PR).
I'm planning to further work on assigning PR capacity limit, and then refactor the way PRs are assigned, and add back logging (and then we can hopefully enable the new assignment logic again).
I did not want to do all that in this PR, hence I commented this code.
issue.number, | ||
filtered_candidates | ||
); | ||
// let filtered_candidates = filter_by_capacity(db, &candidates) |
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.
Similar here.
Assignment based on review preferences is not working currently.
d64caa6
to
b7c8cd8
Compare
Let me know if you want further changes :) |
This PR stops using
assigned_prs
column in thereview_prefs
table, and remembers PR assignments in-memory instead.