]> iEval git - gruntmaster-daemon.git/commitdiff
Re-add multiple daemon support
authorMarius Gavrilescu <marius@ieval.ro>
Mon, 9 Feb 2015 08:00:06 +0000 (10:00 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Mon, 9 Feb 2015 08:00:06 +0000 (10:00 +0200)
lib/Gruntmaster/Daemon.pm

index 3a836924afebea26ff627c55c4fa342365332fcd..7b41d66131bd76b0933457c02ae7e19910aedf5d 100644 (file)
@@ -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);
        }
 }
 
This page took 0.03349 seconds and 4 git commands to generate.