Skip to content

Commit

Permalink
make revision lookup fallible
Browse files Browse the repository at this point in the history
  • Loading branch information
fee1-dead committed May 25, 2024
1 parent 393182a commit 207ff0d
Showing 1 changed file with 8 additions and 4 deletions.
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

0 comments on commit 207ff0d

Please sign in to comment.