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

Store assigned PRs in memory #1906

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Kobzol
Copy link
Contributor

@Kobzol Kobzol commented Feb 18, 2025

This PR stops using assigned_prs column in the review_prefs table, and remembers PR assignments in-memory instead.

@Kobzol Kobzol marked this pull request as ready for review February 18, 2025 17:34
@Kobzol Kobzol force-pushed the assigned-prs-in-memory branch from 1a93fe6 to 3fde3dd Compare February 18, 2025 17:34
@Kobzol Kobzol requested a review from jackh726 February 20, 2025 08:36
@Kobzol Kobzol force-pushed the assigned-prs-in-memory branch from 3fde3dd to d64caa6 Compare February 21, 2025 16:13
@Kobzol
Copy link
Contributor Author

Kobzol commented Feb 21, 2025

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>>,
Copy link
Member

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.

Copy link
Contributor Author

@Kobzol Kobzol Feb 22, 2025

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;
Copy link
Member

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.

Copy link
Contributor Author

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)
Copy link
Member

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.
@Kobzol Kobzol force-pushed the assigned-prs-in-memory branch from d64caa6 to b7c8cd8 Compare February 22, 2025 17:36
@Kobzol
Copy link
Contributor Author

Kobzol commented Mar 3, 2025

Let me know if you want further changes :)

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

Successfully merging this pull request may close these issues.

2 participants