Bug 18651: Use a READ and WRITE LOCK

For more info, see:
  commit be156d9ad9
    Bug 15854: Use a READ and WRITE LOCK on message_queue
and
  commit b40456f7dd
    Bug 18364: Do not LOCK/UNLOCK tables from tests

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(cherry picked from commit 59fcad685e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Jonathan Druart 2017-05-24 12:24:53 -03:00 committed by Fridolin Somers
parent 37b02f63d8
commit 67eafdb251
1 changed files with 7 additions and 0 deletions

View File

@ -2172,7 +2172,12 @@ sub MarkIssueReturned {
push @bind, $issue_id;
# FIXME Improve the return value and handle it from callers
my $do_not_lock = ( exists $ENV{_} && $ENV{_} =~ m|prove| ) || $ENV{KOHA_NO_TABLE_LOCKS};
$schema->txn_do(sub {
C4::Context->dbh->do(q|LOCK TABLE old_issues READ|) unless $do_not_lock;
C4::Context->dbh->do(q|LOCK TABLE old_issues WRITE|) unless $do_not_lock;
$dbh->do( $query, undef, @bind );
my $original_issue_id = $issue_id;
@ -2209,6 +2214,8 @@ sub MarkIssueReturned {
my $patron = Koha::Patrons->find( $borrowernumber );
$item->last_returned_by( $patron );
}
C4::Context->dbh->do(q|UNLOCK TABLES|) unless $do_not_lock;
});
return $issue_id;