← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:gunicorn-disable-main-thread-check into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:gunicorn-disable-main-thread-check into launchpad:master.

Commit message:
Disable break_main_thread_db_access on gunicorn

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/405176

It only really makes sense on zope.server.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:gunicorn-disable-main-thread-check into launchpad:master.
diff --git a/lib/lp/services/webapp/adapter.py b/lib/lp/services/webapp/adapter.py
index 04a779a..cbb3bde 100644
--- a/lib/lp/services/webapp/adapter.py
+++ b/lib/lp/services/webapp/adapter.py
@@ -461,6 +461,11 @@ def break_main_thread_db_access(*ignored):
     easier to do on module load, but the test suite has legitimate uses
     for using connections from the main thread.
     """
+    # This check is only applicable to zope.server.  gunicorn uses a
+    # different model with an arbiter parent process.
+    if config.use_gunicorn:
+        return
+
     # Record the ID of the main thread.
     global _main_thread_id
     _main_thread_id = threading.current_thread().ident