Vigilant keeps watch over your processes and kills them if they misbehave.
Examples:
# limit memory of process to 5mb
:ok = Vigilant.limit_memory(self(), 5)
# equivalent to
:ok = Vigilant.limit_memory(5)
# enforce a timeout
Vigilant.enforce_timeout(fn ->
Process.sleep(10000000000)
end, 1000, fn ->
Logger.debug("process killed because timeout was exceeded")
end)
If available in Hex, the package can be installed
by adding vigilant
to your list of dependencies in mix.exs
:
def deps do
[
{:vigilant, "~> 0.1.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/vigilant.