From c906a12c178014c3edc7118e1d010a1d659ed3d8 Mon Sep 17 00:00:00 2001 From: Alexei Pastuchov Date: Wed, 3 May 2017 13:13:55 +0200 Subject: [PATCH] gearmand should release http client if request contains 'X-Gearman-Background: true' header --- .../plugins/protocol/http/protocol.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/libgearman-server/plugins/protocol/http/protocol.cc b/libgearman-server/plugins/protocol/http/protocol.cc index aa84a0326..a3f2c61f9 100644 --- a/libgearman-server/plugins/protocol/http/protocol.cc +++ b/libgearman-server/plugins/protocol/http/protocol.cc @@ -164,11 +164,15 @@ class HTTPtext : public gearmand::protocol::Context case GEARMAN_COMMAND_JOB_CREATED: { - gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, - "Sending HTTP told to ignore packet: gearmand_command_t:%s", - gearman_strcommand(packet->command)); - ret_ptr= GEARMAND_IGNORE_PACKET; - return 0; + if(this->_background) { + ret_ptr = GEARMAND_SUCCESS; + } else { + gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM, + "Sending HTTP told to ignore packet: gearmand_command_t:%s", + gearman_strcommand(packet->command)); + ret_ptr= GEARMAND_IGNORE_PACKET; + return 0; + } } }