https://github.com/hrefhref/gen_magic_pool
Scalable pool for gen_magic
https://github.com/hrefhref/gen_magic_pool
Last synced: 1 day ago
JSON representation
Scalable pool for gen_magic
- Host: GitHub
- URL: https://github.com/hrefhref/gen_magic_pool
- Owner: hrefhref
- Created: 2020-06-15T17:37:38.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-06-15T17:54:28.000Z (about 5 years ago)
- Last Synced: 2025-05-17T18:07:58.266Z (about 1 month ago)
- Language: Elixir
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GenMagic.Pool
Reliability and scalability pool for [gen_magic](https://github.com/evadne/gen_magic), based on [nimble_pool](https://github.com/dashbitco/nimble_pool).
## Installation
```elixir
def deps do
[
{:gen_magic, "~> 1.0"},
{:gen_magic_pool, "~> 0.1.0"}
]
end
```## Usage
Define a pool in your application supervisor by adding it as a child:
```
children =
[
# ...
{GenMagic.Pool, [name: YourApp.GenMagicPool]}
]opts = [strategy: :one_for_one, name: YourApp.Supervisor]
Supervisor.start_link(children, opts)
```And then you can use it with `GenMagic.Pool.perform/2`:
```
iex(1)> GenMagic.Pool.perform(YourApp.GenMagicPool, Path.expand("~/.bash_history"))
{:ok, %GenMagic.Result{mime_type: "text/plain", encoding: "us-ascii", content: "ASCII text"}}
```By default, a `GenMagic.Server` worker will be started for every online scheduler.