From 428bfc18faf4e37bf8f5203aab4402945dba3327 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 3 Jun 2015 11:15:56 +0200 Subject: [PATCH] =?utf8?q?Task-Server:=20vor=20Schlafen=20aufr=C3=A4umen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Dabei werden unter Anderem potenziell noch laufende Transaktionen beendet und zumindest das Standard-DBH (nicht das von Rose) geschlossen. Dadurch sollten alle Locks, die durch die Jobs evtl. entstanden sind, wieder aufgelöst worden sein. --- scripts/task_server.pl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/task_server.pl b/scripts/task_server.pl index d515e33c0..661c19a76 100755 --- a/scripts/task_server.pl +++ b/scripts/task_server.pl @@ -82,6 +82,20 @@ sub initialize_kivitendo { $::form->{__ERROR_HANDLER} = sub { die @_ }; } +sub cleanup_kivitendo { + eval { SL::DB::Auth->new->db->dbh->rollback; }; + eval { SL::DB::BackgroundJob->new->db->dbh->rollback; }; + + $::auth->save_session; + $::auth->expire_sessions; + $::auth->reset; + + $::form = undef; + $::myconfig = (); + $::request = undef; + Form::disconnect_standard_dbh; +} + sub drop_privileges { my $user = $lx_office_conf{task_server}->{run_as}; return unless $user; @@ -199,6 +213,8 @@ sub gd_run { notify_on_failure(exception => $error); } + cleanup_kivitendo(); + debug("Sleeping"); my $seconds = 60 - (localtime)[0]; -- 2.20.1