myfreeweb/httpotion — pull request #40 by adamkittelson (2014-12-15 23:13:42+00:00)
Title: wrap send_req_direct

I'm using HTTPotion with a service that has long polling as an option. Some of my requests would benefit from long polling but others need to be fast. Since both types of request are going to the same host ibrowse is sometimes queuing requests that should be fast behind long poll requests which isn't ideal. The send_req_direct functions in ibrowse let me get around this by sending my long poll requests to a separate pid so they don't go in the connection pool and get in the way of my other requests so I've wrapped that in this pull request.

I did some refactoring to avoid duplicating a bunch of code that would be shared between send_req and send_req_direct.

Also the reason spawn_worker_process and spawn_link_worker process don't just call their ibrowse equivalents is that it looks like ibrowse doesn't let you pass in your own options for the gen_server and I wanted to be able to provide a name for my worker process to be registered under when started by a supervisor so I can use that even if the worker process is restarted.

Let me know if you have any questions or think anything needs to change in order to merge this in.

Thanks!