Skip to content

Commit

Permalink
mldistwatch: Rewrite perms/primeur in the transaction
Browse files Browse the repository at this point in the history
Otherwise, we could (historically) deadlock when trying to
delete from primeur *after* we've already deleted from perms,
and folks would lose comaint permissions, or other weird cases
could happen

By bringing this logic into the transaction, we should avoid
weird broken indexing.

Surely not doing this in a transaction was a mistake when this
code was introduced.
  • Loading branch information
wolfsage authored and andk committed Apr 26, 2024
1 parent 5728905 commit c7e2da0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/PAUSE/mldistwatch.pm
Original file line number Diff line number Diff line change
Expand Up @@ -367,15 +367,15 @@ sub _do_the_database_work {
my $main_pkg = $dio->_package_governing_permission;

if ($self->permissions->userid_has_permissions_on_package($dio->{USERID}, $main_pkg)) {
$dio->normalize_package_casing;

$dbh->commit;
} else {
$dio->alert("Uploading user has no permissions on package $main_pkg");
$dio->{NO_DISTNAME_PERMISSION} = 1;
$dbh->rollback;
}

$dio->normalize_package_casing;

return 1;
};

Expand Down

0 comments on commit c7e2da0

Please sign in to comment.