Skip to content

iamafanasyev/with_timeout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WithTimeout

Elixir CI

Both total and time limited evaluation of expressions

Usage

iex> fn -> 42 end |> WithTimeout.evaluate(within_milliseconds: 100)
{:ok, 42}

iex> fn -> Process.sleep(200); 42 end |> WithTimeout.evaluate(within_milliseconds: 100)
{:error, :timeout}

iex> fn -> raise "42" end |> WithTimeout.evaluate(within_milliseconds: 100)
{:error, {:exception, %RuntimeError{message: "42"}, [...]}}

More advanced usages can be found in tests

Installation

The package can be installed by adding with_timeout to your list of dependencies in mix.exs:

def deps do
  [
    {:with_timeout, "~> 0.1.0"}
  ]
end

Documentation can be found at https://hexdocs.pm/with_timeout

About

Both total and time limited evaluation of expressions

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages