Skip to content

Commit 9f091b6

Browse files
authored
Celery: don't use a signal object, but a string instead (#12333)
I've started noticing this some days ago and today I tried to debug it a little. I didn't find anything in our side, so I opened an issue at django-structlog. jrobichaud/django-structlog#870 However, it ended up being our fault, so I'm updating our code here to avoid keep failing and log this line properly.
1 parent 9007e44 commit 9f091b6

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

readthedocs/core/utils/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Common utility functions."""
22

33
import re
4-
import signal
54

65
import structlog
76
from django.conf import settings
@@ -279,7 +278,7 @@ def cancel_build(build):
279278
build_task_id=build.task_id,
280279
terminate=terminate,
281280
)
282-
app.control.revoke(build.task_id, signal=signal.SIGINT, terminate=terminate)
281+
app.control.revoke(build.task_id, signal="SIGINT", terminate=terminate)
283282

284283

285284
def send_email_from_object(email: EmailMultiAlternatives | EmailMessage):

readthedocs/rtd_tests/tests/test_core_utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"""Test core util functions."""
2-
import signal
32
from unittest import mock
43

54
import pytest
@@ -209,8 +208,8 @@ def test_trigger_max_concurrency_reached(self, update_docs, app):
209208
)
210209
app.control.revoke.assert_has_calls(
211210
[
212-
mock.call("1", signal=signal.SIGINT, terminate=True),
213-
mock.call("0", signal=signal.SIGINT, terminate=True),
211+
mock.call("1", signal="SIGINT", terminate=True),
212+
mock.call("0", signal="SIGINT", terminate=True),
214213
]
215214
)
216215

0 commit comments

Comments
 (0)