-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
The complete script is below. Running it with invalid connection parameters immediately returns with an error:
$ ./script.ml -host 127.0.0.1 -port 8097
bad connection
However, using the correct port leads to:
$ ./script.ml -host 127.0.0.1 -port 8098
(* never returns *)
I verified that the normal riak client does ping correctly:
$ riak ping
pong
script.ml
#! /usr/bin/env ocamlscript
Ocaml.ocamlflags := ["-thread"];
Ocaml.packs := ["core"; "async"; "riakc"]
--
open Core.Std
open Async.Std
let main host port : unit Deferred.t =
let open Deferred.Result.Monad_infix in
Riakc.Conn.connect ~host ~port
>>= (fun db -> Riakc.Conn.ping db)
|> Deferred.map ~f:(function
| Ok () -> printf "ping succeeded\n"
| Error `Bad_conn -> printf "bad connection\n"
| Error `Bad_payload -> printf "bad payload\n"
| Error _ -> printf "other error\n"
)
let command =
Command.async_basic
~summary:"test program"
Command.Spec.(
empty
+> flag "host" (required string) ~doc:"HOST host name"
+> flag "port" (required int) ~doc:"PORT port number"
)
(fun host port () -> main host port)
let () = Command.run command
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels