From: Marius Gavrilescu Date: Mon, 9 Feb 2015 08:00:06 +0000 (+0200) Subject: Re-add multiple daemon support X-Git-Tag: 5999.000_005~37 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=19f0465bd8ca1792390c55b97d558a8b7fc0c908;p=gruntmaster-daemon.git Re-add multiple daemon support --- diff --git a/lib/Gruntmaster/Daemon.pm b/lib/Gruntmaster/Daemon.pm index 3a83692..7b41d66 100644 --- a/lib/Gruntmaster/Daemon.pm +++ b/lib/Gruntmaster/Daemon.pm @@ -144,14 +144,13 @@ sub got_job{ my $id = $job->id; get_logger->debug("Taking job $id..."); my $daemon = hostname . ":$$"; - $job->update({daemon => $daemon}); - #if (set_job_daemon $job, hostname . ":$$") { - if (1) { + $job->update({daemon => $daemon}, {where => {daemon => undef}})->discard_changes; + if ($job->daemon eq $daemon) { get_logger->debug("Succesfully taken job $id"); process_job $job; get_logger->debug("Job $id done"); } else { - get_logger->debug("Job $id already taken"); + get_logger->debug("Job $id already taken by " . $job->daemon); } }