From 139fdbb0eefa341f0dce1dc982b60daa983dde99 Mon Sep 17 00:00:00 2001 From: janw Date: Fri, 27 Feb 2009 11:54:57 +0000 Subject: [PATCH] Don't delete lockfile when starting. Allows multiple processes to use locks. Add comment to exec_statementlist to explain why we obtain a lock for every statement. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13477 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/modules/DBsqlite.pm | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/gosa-si/modules/DBsqlite.pm b/gosa-si/modules/DBsqlite.pm index 541dfbb77..0e1da74f6 100644 --- a/gosa-si/modules/DBsqlite.pm +++ b/gosa-si/modules/DBsqlite.pm @@ -16,11 +16,6 @@ sub new { my $db_name = shift; my $lock = $db_name.".si.lock"; - # delete existing lock - instance should be running only once - if(stat($lock)) { - &main::daemon_log("DEBUG: Removed existing lock file $lock.", 7); - unlink($lock); - } my $self = {dbh=>undef,db_name=>undef,db_lock=>undef,db_lock_handle=>undef}; my $dbh = DBI->connect("dbi:SQLite:dbname=$db_name", "", "", {RaiseError => 1, AutoCommit => 1}); $self->{dbh} = $dbh; @@ -330,6 +325,7 @@ sub exec_statementlist { foreach my $sql (@$sql_list) { if(defined($sql) && length($sql) > 0) { + # Obtain a new lock for each statement to not block the db for a too long time $self->lock(); eval { my @answer = @{$self->{dbh}->selectall_arrayref($sql)}; -- 2.30.2