more
This commit is contained in:
parent
a1679df6a6
commit
d747aa1cca
2 changed files with 12 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
open Pam.Datatypes
|
||||
open Pam.Issue_parser
|
||||
open Batteries
|
||||
open Utils
|
||||
|
||||
|
@ -11,14 +12,22 @@ let _HTTP_CLIENT = "http_client"
|
|||
**)
|
||||
let http_client (repos: Config.repo_data list) =
|
||||
let http_actor = Httpclient.init repos in
|
||||
|
||||
let _ = print_endline "Initialized http client" in
|
||||
|
||||
|
||||
let rec loop () =
|
||||
let _ =
|
||||
match Riot.receive () with
|
||||
| ListIssues ->
|
||||
Httpclient.make_get_request http_actor
|
||||
|> Result.map Pam.Datatypes.forgejo_issues
|
||||
(* |> Result.map Pam.Datatypes.forgejo_issues *)
|
||||
|> Result.bind (fun issue ->
|
||||
match to_datetime issue with
|
||||
| Error e -> Error e |> Option.some
|
||||
| Ok None -> None
|
||||
| Ok (Some times) -> failwith "dunno"
|
||||
)
|
||||
|> Result.map_error Pam.Datatypes.internal_failure
|
||||
|> Result.fold ~ok:identity ~error:(fun e -> [e])
|
||||
|> List.map (Riot.send_by_name ~name:_MQ_CLIENT)
|
||||
|
|
|
@ -20,3 +20,5 @@ let one_second = 1_000_000L
|
|||
let exit2 msg = let _ = print_endline msg in exit 2
|
||||
|
||||
module StringMap = Map.Make (String)
|
||||
|
||||
let rec all acc = function [] -> Ok acc | Ok x::xs -> all (x::acc) xs | Error e::_ -> Error e
|
||||
|
|
Loading…
Reference in a new issue