Skip to content

Commit 9133797

Browse files
committed
add request timeout option and update docs
1 parent 865f6ba commit 9133797

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,27 @@ extension:
6161
```python
6262
DEFAULT_OPTIONS = {
6363
"slack_beat_init_color": "#FFCC2B",
64+
"slack_broker_connect_color": "#36A64F",
65+
"slack_broker_disconnect_color": "#D00001",
6466
"slack_celery_startup_color": "#FFCC2B",
6567
"slack_celery_shutdown_color": "#660033",
6668
"slack_task_prerun_color": "#D3D3D3",
6769
"slack_task_success_color": "#36A64F",
6870
"slack_task_failure_color": "#D00001",
71+
"slack_request_timeout": 1,
6972
"flower_base_url": None,
73+
"show_celery_hostname": False,
7074
"show_task_id": True,
7175
"show_task_execution_time": True,
72-
"show_celery_hostname": False,
7376
"show_task_args": True,
7477
"show_task_kwargs": True,
7578
"show_task_exception_info": True,
7679
"show_task_return_value": True,
77-
"show_task_prerun": True,
80+
"show_task_prerun": False,
7881
"show_startup": True,
7982
"show_shutdown": True,
8083
"show_beat": True,
84+
"show_broker": False,
8185
"use_fixed_width": True,
8286
"include_tasks": None,
8387
"exclude_tasks": None,
@@ -103,6 +107,7 @@ Most of the options are self explanatory, but here are some additional details:
103107

104108
* **slack_\*_color**: The left vertical bar color associated with the slack
105109
message attachments
110+
* **slack_request_timeout**: The Slack message request timeout in seconds
106111
* **flower_base_url**: e.g. https://flower.example.com, if provided, the slack
107112
message titles will link to task pages in
108113
[Flower](http://flower.readthedocs.io/en/latest/)

README.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,23 +84,27 @@ extension:
8484
8585
DEFAULT_OPTIONS = {
8686
"slack_beat_init_color": "#FFCC2B",
87+
"slack_broker_connect_color": "#36A64F",
88+
"slack_broker_disconnect_color": "#D00001",
8789
"slack_celery_startup_color": "#FFCC2B",
8890
"slack_celery_shutdown_color": "#660033",
8991
"slack_task_prerun_color": "#D3D3D3",
9092
"slack_task_success_color": "#36A64F",
9193
"slack_task_failure_color": "#D00001",
94+
"slack_request_timeout": 1,
9295
"flower_base_url": None,
96+
"show_celery_hostname": False,
9397
"show_task_id": True,
9498
"show_task_execution_time": True,
95-
"show_celery_hostname": False,
9699
"show_task_args": True,
97100
"show_task_kwargs": True,
98101
"show_task_exception_info": True,
99102
"show_task_return_value": True,
100-
"show_task_prerun": True,
103+
"show_task_prerun": False,
101104
"show_startup": True,
102105
"show_shutdown": True,
103106
"show_beat": True,
107+
"show_broker": False,
104108
"use_fixed_width": True,
105109
"include_tasks": None,
106110
"exclude_tasks": None,
@@ -127,6 +131,7 @@ Most of the options are self explanatory, but here are some additional details:
127131

128132
* **slack_\*_color**: The left vertical bar color associated with the slack
129133
message attachments
134+
* **slack_request_timeout**: The Slack message request timeout in seconds
130135
* **flower_base_url**: e.g. https://flower.example.com, if provided, the slack
131136
message titles will link to task pages
132137
in `Flower <http://flower.readthedocs.io/en/latest/>`_

celery_slack/slackify.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from .exceptions import InvalidColorException
1919
from .exceptions import MissingWebhookException
2020
from .exceptions import TaskFiltrationException
21+
from celery_slack import slack
2122

2223

2324
DEFAULT_OPTIONS = {
@@ -29,6 +30,7 @@
2930
"slack_task_prerun_color": "#D3D3D3",
3031
"slack_task_success_color": "#36A64F",
3132
"slack_task_failure_color": "#D00001",
33+
"slack_request_timeout": 1,
3234
"flower_base_url": None,
3335
"show_celery_hostname": False,
3436
"show_task_id": True,
@@ -89,6 +91,8 @@ def __init__(self, app, webhook=None, beat_schedule=None, **options):
8991
self._decorate_task_methods()
9092
self._decorate_kombu_retry()
9193

94+
slack.TIMEOUT = self.options["slack_request_timeout"]
95+
9296
def _connect_signals(self):
9397
"""Connect callbacks to celery signals.
9498

docs/usage.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,27 @@ extension:
3838
3939
DEFAULT_OPTIONS = {
4040
"slack_beat_init_color": "#FFCC2B",
41+
"slack_broker_connect_color": "#36A64F",
42+
"slack_broker_disconnect_color": "#D00001",
4143
"slack_celery_startup_color": "#FFCC2B",
4244
"slack_celery_shutdown_color": "#660033",
4345
"slack_task_prerun_color": "#D3D3D3",
4446
"slack_task_success_color": "#36A64F",
4547
"slack_task_failure_color": "#D00001",
48+
"slack_request_timeout": 1,
4649
"flower_base_url": None,
50+
"show_celery_hostname": False,
4751
"show_task_id": True,
4852
"show_task_execution_time": True,
49-
"show_celery_hostname": False,
5053
"show_task_args": True,
5154
"show_task_kwargs": True,
5255
"show_task_exception_info": True,
5356
"show_task_return_value": True,
54-
"show_task_prerun": True,
57+
"show_task_prerun": False,
5558
"show_startup": True,
5659
"show_shutdown": True,
5760
"show_beat": True,
61+
"show_broker": False,
5862
"use_fixed_width": True,
5963
"include_tasks": None,
6064
"exclude_tasks": None,

tests/celeryapp/celeryapp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
# "show_celery_hostname": True,
3232
# "show_startup": False,
3333
# "show_shutdown": False,
34+
"slack_request_timeout": 3,
3435
"show_broker": True,
3536
}
3637

0 commit comments

Comments
 (0)