Read all EZFIO in memory before run starts

This commit is contained in:
Anthony Scemama 2020-04-15 19:25:43 +02:00
parent 5deb4bef6b
commit b12ac1be79
3 changed files with 14 additions and 3 deletions

View File

@ -587,12 +587,17 @@ let run ?(daemon=true) ezfio_filename =
| None ->
begin
let result =
decode_ezfio_message msg
Qptypes.decode_ezfio_message msg
in
Hashtbl.add ezfio_cache msg result;
result
end
in
List.iter (fun x ->
if handle_ezfio ("has_"^x) = "T" then
try ignore @@ handle_ezfio ("get_"^x)
with Failure _ -> ())
Qptypes.all_ezfio_messages;
(** Pull socket for computed data *)
let pull_socket =

View File

@ -54,7 +54,6 @@ let run ezfio_filename dataserver =
| Unix.Unix_error _ ->
begin
Unix.chdir tmpdir;
Unix.sleepf 0.1 ;
if Sys.file_exists "PID" then
begin
let pid =

View File

@ -341,7 +341,14 @@ match msg with " ] @
List.map (fun (x,_,_,_) ->
Printf.sprintf " | \"%s\" -> if (Ezfio.%s ()) then \"T\" else \"F\"" x x
) has_functions
) @ [" | x -> failwith (x^\" : Unknown EZFIO function\")\n;;"]
)
@ [" | x -> failwith (x^\" : Unknown EZFIO function\")\n;;" ;
"" ; "let all_ezfio_messages = [ " ] @
(
List.rev_map (fun (x,_,_,_) ->
Printf.sprintf " \"%s\" ; " (String.sub x 4 ((String.length x)-4))
) has_functions
) @ ["]"]
in
String.concat "\n" result
|> print_endline