Code

Don't delete lockfile when starting. Allows multiple processes to use locks.
authorjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 27 Feb 2009 11:54:57 +0000 (11:54 +0000)
committerjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 27 Feb 2009 11:54:57 +0000 (11:54 +0000)
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

index 541dfbb77105e72af54d90245520d5b8cadc0e3d..0e1da74f6c5ea6b8ad8f4d500ee0e6f28d8b0f19 100644 (file)
@@ -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)};