before patch: there left a lot of netstat in TIME_WAIT docker0_ip:3060 scheduler_ip:any_port TIME_WAIT it's timewait timer is 60s. after 60s, this any_port will be released
after this patch: http connect to taskqueue will be release as soon as the visit is finished (after submit job | consume job)
Signed-off-by: Tong Qunfeng taxcom@tom.com --- src/lib/taskqueue_api.cr | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/lib/taskqueue_api.cr b/src/lib/taskqueue_api.cr index 8d0db5d..99c3933 100644 --- a/src/lib/taskqueue_api.cr +++ b/src/lib/taskqueue_api.cr @@ -12,7 +12,9 @@ class TaskQueueAPI
def add_task(service_queue_path : String, task : JSON::Any) params = HTTP::Params.encode({"queue" => service_queue_path}) - response = HTTP::Client.post("http://#%7B@host%7D:#%7B@port%7D/add?" + params, body: task.to_json) + client = HTTP::Client.new(@host, port: @port) + response = client.post("/add?" + params, body: task.to_json) + client.close arrange_response(response) end
@@ -32,7 +34,9 @@ class TaskQueueAPI end
private def response_put_api(cmd : String, params : String) - response = HTTP::Client.put("http://#%7B@host%7D:#%7B@port%7D/#%7Bcmd%7D?" + params) + client = HTTP::Client.new(@host, port: @port) + response = client.put("/#{cmd}?" + params) + client.close arrange_response(response) end