Add unit variable type and 'reloaded()' function.
[whenjobs.git] / daemon / daemon.ml
index 47a67ed..1155f50 100644 (file)
@@ -198,7 +198,7 @@ and reload_file () =
     dependencies := map in
 
   (* Re-evaluate all when jobs. *)
-  reevaluate_whenjobs (StringMap.keys !jobs);
+  reevaluate_whenjobs ~onload:true (StringMap.keys !jobs);
 
   (* Schedule the next every job to run. *)
   schedule_next_everyjob ()
@@ -207,7 +207,7 @@ and reload_file () =
  * a fixpoint.  Run those that need to be run.  every-statement jobs
  * are ignored here.
  *)
-and reevaluate_whenjobs jobnames =
+and reevaluate_whenjobs ?(onload=false) jobnames =
   let rec loop set jobnames =
     let set' =
       List.fold_left (
@@ -218,7 +218,7 @@ and reevaluate_whenjobs jobnames =
           assert (jobname = job.job_name);
 
           let r, job' =
-            try job_evaluate job !variables
+            try job_evaluate job !variables onload
             with Invalid_argument err | Failure err ->
               Syslog.error "error evaluating job %s (at %s): %s"
                 jobname (Camlp4.PreCast.Ast.Loc.to_string job.job_loc) err;