Skip to content

Commit 5fa48d1

Browse files
amanda11Kami
andauthored
Stop hang when use mongo SSL (#5240)
* Stop hang when use mongo SSL * Fix black * Update CHANGELOG.rst * Update wsgi.py Perform monkey patch as the very first thing - even before importing os module. * Remove testing change, also run micro benchmarks under 3.8. Co-authored-by: Tomaz Muraus <[email protected]>
1 parent 78ae28e commit 5fa48d1

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

.github/workflows/microbenchmarks.yaml

+5-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
name: Micro Benchmarks
44

55
on:
6-
pull_request:
7-
type: [opened, reopened, edited]
8-
branches:
9-
# Only for PRs targeting those branches
10-
- master
11-
- v[0-9]+.[0-9]+
126
schedule:
137
- cron: '30 3 * * *'
148

@@ -43,6 +37,11 @@ jobs:
4337
nosetests_node_total: 1
4438
nosetests_node_index: 0
4539
python-version: '3.6'
40+
- name: 'Microbenchmarks'
41+
task: 'micro-benchmarks'
42+
nosetests_node_total: 1
43+
nosetests_node_index: 0
44+
python-version: '3.8'
4645
services:
4746
mongo:
4847
image: mongo:4.4

CHANGELOG.rst

+4
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,10 @@ Changed
234234

235235
Contributed by @chadpatt .
236236

237+
* Monkey patch on st2stream earlier in flow #5240
238+
239+
Contributed by Amanda McGuinness (@amanda11 Ammeon Solutions)
240+
237241
Improvements
238242
~~~~~~~~~~~~
239243

st2stream/st2stream/app.py

-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
from st2common.middleware.instrumentation import RequestInstrumentationMiddleware
3535
from st2common.middleware.instrumentation import ResponseInstrumentationMiddleware
3636
from st2common.router import Router
37-
from st2common.util.monkey_patch import monkey_patch
3837
from st2common.constants.system import VERSION_STRING
3938
from st2common.service_setup import setup as common_setup
4039
from st2common.util import spec_loader
@@ -47,10 +46,6 @@ def setup_app(config={}):
4746

4847
is_gunicorn = config.get("is_gunicorn", False)
4948
if is_gunicorn:
50-
# Note: We need to perform monkey patching in the worker. If we do it in
51-
# the master process (gunicorn_config.py), it breaks tons of things
52-
# including shutdown
53-
monkey_patch()
5449

5550
st2stream_config.register_opts(ignore_errors=True)
5651
capabilities = {

st2stream/st2stream/wsgi.py

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16+
from st2common.util.monkey_patch import monkey_patch
17+
18+
monkey_patch()
19+
1620
import os
1721

1822
from st2stream import app

0 commit comments

Comments
 (0)