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

make revision lookup fallible #105

Merged
merged 1 commit into from
May 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions dbreps2/src/general/ownerlessuserpages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ WHERE gu_name = ?
Ok(row.is_some())
}

async fn lookup_revision(conn: &mut Conn, row: &FirstRow) -> Result<SecondRow> {
async fn lookup_revision(
conn: &mut Conn,
row: &FirstRow,
) -> Result<Option<SecondRow>> {
Ok(conn
.exec_map(
r#"
Expand All @@ -81,8 +84,7 @@ LIMIT
)
.await?
.into_iter()
.next()
.unwrap())
.next())
}

pub struct Ownerlessuserpages {}
Expand Down Expand Up @@ -143,7 +145,9 @@ WHERE
if user_exists_globally(&mut ca_conn, &username).await? {
continue;
}
let rev = lookup_revision(conn, &row).await?;
let Some(rev) = lookup_revision(conn, &row).await? else {
continue;
};
last.push(Row {
page_namespace: row.page_namespace,
page_title: row.page_title,
Expand Down
Loading