agent_pool
A shard to handle agent pooling with reusable connections and connection timeouts.
The AgentPool is based on the pool in use by crystal-db.
Installation
-
Add the dependency to your
shard.yml
:dependencies: agent_pool: github: aluminumio/agent_pool
-
Run
shards install
Usage
require "agent_pool"
pool = AgentPool::AgentPool(Agent).new {|destination| Agent.new(destination) }
agent = pool.checkout("destination")
spawn do
agent.do_work("abcd")
pool.release(agent, "destination")
end
TODO Write usage instructions here
Development
TODO Handle timeouts raised by agents.
Contributing
- Fork it (https://github.com/aluminumio/agent_pool/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- usiegl00 - creator and maintainer