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.Datatypes
|
||||||
|
open Pam.Issue_parser
|
||||||
open Batteries
|
open Batteries
|
||||||
open Utils
|
open Utils
|
||||||
|
|
||||||
|
@ -11,14 +12,22 @@ let _HTTP_CLIENT = "http_client"
|
||||||
**)
|
**)
|
||||||
let http_client (repos: Config.repo_data list) =
|
let http_client (repos: Config.repo_data list) =
|
||||||
let http_actor = Httpclient.init repos in
|
let http_actor = Httpclient.init repos in
|
||||||
|
|
||||||
let _ = print_endline "Initialized http client" in
|
let _ = print_endline "Initialized http client" in
|
||||||
|
|
||||||
|
|
||||||
let rec loop () =
|
let rec loop () =
|
||||||
let _ =
|
let _ =
|
||||||
match Riot.receive () with
|
match Riot.receive () with
|
||||||
| ListIssues ->
|
| ListIssues ->
|
||||||
Httpclient.make_get_request http_actor
|
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.map_error Pam.Datatypes.internal_failure
|
||||||
|> Result.fold ~ok:identity ~error:(fun e -> [e])
|
|> Result.fold ~ok:identity ~error:(fun e -> [e])
|
||||||
|> List.map (Riot.send_by_name ~name:_MQ_CLIENT)
|
|> 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
|
let exit2 msg = let _ = print_endline msg in exit 2
|
||||||
|
|
||||||
module StringMap = Map.Make (String)
|
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