aboutsummaryrefslogtreecommitdiff
path: root/lib/gateway
diff options
context:
space:
mode:
authorAdelyn Breedlove <[email protected]>2019-03-06 10:41:18 -0700
committerAdelyn Breedlove <[email protected]>2019-03-06 10:41:18 -0700
commitf68838306a66cb358688f4976c5770db89293db4 (patch)
treebdd6388df7f0fbf9c7512485e91da83a7ec47821 /lib/gateway
parentClose frames should log code now (diff)
downloaddisml-f68838306a66cb358688f4976c5770db89293db4.tar.xz
disml-f68838306a66cb358688f4976c5770db89293db4.zip
Unfuck the cache
Diffstat (limited to 'lib/gateway')
-rw-r--r--lib/gateway/event.ml8
-rw-r--r--lib/gateway/event.mli2
2 files changed, 4 insertions, 6 deletions
diff --git a/lib/gateway/event.ml b/lib/gateway/event.ml
index af9861d..25311a2 100644
--- a/lib/gateway/event.ml
+++ b/lib/gateway/event.ml
@@ -1,4 +1,3 @@
-open Lwt.Infix
open Event_models
type t =
@@ -203,7 +202,6 @@ let dispatch cache ev =
cache
let handle_event ~ev contents =
- Lwt_mvar.take Cache.cache >>= fun cache ->
- event_of_yojson ~contents ev
- |> dispatch cache
- |> Lwt_mvar.put Cache.cache \ No newline at end of file
+ Cache.update Cache.cache (fun cache ->
+ event_of_yojson ~contents ev
+ |> dispatch cache) \ No newline at end of file
diff --git a/lib/gateway/event.mli b/lib/gateway/event.mli
index 1817c52..fd70ba8 100644
--- a/lib/gateway/event.mli
+++ b/lib/gateway/event.mli
@@ -43,7 +43,7 @@ type t =
val event_of_yojson : contents:Yojson.Safe.t -> string -> t
(** Sends the event to the registered handler. *)
-val dispatch : Cache.t -> t -> Cache.t
+val dispatch : Cache.cache -> t -> Cache.cache
(** Wrapper to other functions. This is called from the shards. *)
val handle_event : ev:string -> Yojson.Safe.t -> unit Lwt.t \ No newline at end of file