X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;ds=sidebyside;f=daemon%2Fdaemon.ml;h=078aa3ab129b965a1efa961ba072434d5eedca79;hb=27dfc74b71d3b3b14a476667481f92c58a6d5c1d;hp=64d4012746771941379030df9a880be2d5951d1f;hpb=de72662854c3db9365296dd45cade2253910be7f;p=whenjobs.git diff --git a/daemon/daemon.ml b/daemon/daemon.ml index 64d4012..078aa3a 100644 --- a/daemon/daemon.ml +++ b/daemon/daemon.ml @@ -145,6 +145,7 @@ and proc_exit_daemon () = | Some s -> Rpc_server.stop_server ~graceful:true s; server := None; + Gc.compact (); (* force the server handle to get cleaned up now *) `ok and proc_get_jobs () = @@ -309,7 +310,9 @@ and reload_files () = else ( let len = String.length file in let t = String.sub file 6 (len-slen-6) in - try Some (int_of_string t) with Failure "int_of_string" -> None + (* Use int64 because t won't necessarily fit into 31 bit int. *) + try Some (Int64.of_string t) + with Failure "int_of_string" -> assert false ) ) files in let times = List.rev (List.sort compare times) in @@ -319,11 +322,11 @@ and reload_files () = (* Unlink the older files. *) List.iter ( fun t -> - try unlink (dir // sprintf "jobs__%d%s" t suffix) + try unlink (dir // sprintf "jobs__%Ld%s" t suffix) with Unix_error _ -> () ) xs; (* Return the newest (highest numbered) file. *) - Some (dir // sprintf "jobs__%d%s" x suffix) in + Some (dir // sprintf "jobs__%Ld%s" x suffix) in (* As we are reloading the file, we want to create a new state * that has no jobs, but has all the variables from the previous