misc: create a new publisher object for running afterjobs (#18351)

This commit is contained in:
Frédéric Péters 2017-09-01 12:39:30 +02:00
parent 459fa64daf
commit 25e6b3e7e5
1 changed files with 4 additions and 1 deletions

View File

@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
import copy
import json
import thread
import threading
@ -112,9 +113,11 @@ class AfterJobsMiddleware(object):
http_response = HTTPResponse()
http_response.after_jobs = response.after_jobs
if self.ASYNC:
publisher = copy.copy(get_publisher())
publisher.pgconn = None
thread.start_new_thread(
http_response.process_after_jobs,
(get_publisher(),))
(publisher,))
else:
http_response.process_after_jobs()
return response