package bonsai

  1. Overview
  2. Docs
A library for building dynamic webapps, using Js_of_ocaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.17.0.tar.gz
sha256=c78c4476ee6b856846e2d0941e5965009d5e1b853e564b2b1bee61202f0b1ebb

doc/bonsai/Bonsai/Effect_throttling/index.html

Module Bonsai.Effect_throttlingSource

Sourcemodule Poll_result : sig ... end
Sourceval poll : ('a -> 'b Effect.t) Value.t -> ('a -> 'b Poll_result.t Effect.t) Computation.t

Transforms an input effect into a new effect that enforces that invariant that at most one instance of the effect is running at once. Attempting to run the effect while a previous run is still ongoing will cause the new effect to be enqueued. Any previously enqueued item gets kicked out, thus maintaining the invariant that at most one effect will be enqueued. (this is important so that things like RPCs calls don't pile up)

CAUTION: This computation assumes that the input effect will always complete. If a run of the effect raises, no more runs will ever get executed, since they will all be waiting for the one that raised to complete.