Skip to content

Commit 9e6f40f

Browse files
committed
Add docs for settings
1 parent b4a7548 commit 9e6f40f

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

docs/settings.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,20 @@ CRAWLERA_DEFAULT_HEADERS
6464

6565
Default: ``{}``
6666

67-
Default headers added only to crawlera requests. Headers defined on ``DEFAULT_REQUEST_HEADERS`` will take precedence as long as the ``CrawleraMiddleware`` is placed after the ``DefaultHeadersMiddleware``*. Headers set on the requests have precedence over the two settings.
67+
Default headers added only to crawlera requests. Headers defined on ``DEFAULT_REQUEST_HEADERS`` will take precedence as long as the ``CrawleraMiddleware`` is placed after the ``DefaultHeadersMiddleware``. Headers set on the requests have precedence over the two settings.
6868

69-
*This is the default behavior, ``DefaultHeadersMiddleware`` default priority is ``400`` and we recommend ``CrawleraMiddleware`` priority to be ``610``
69+
* This is the default behavior, ``DefaultHeadersMiddleware`` default priority is ``400`` and we recommend ``CrawleraMiddleware`` priority to be ``610``
70+
71+
CRAWLERA_BACKOFF_STEP
72+
-----------------------
73+
74+
Default: ``15``
75+
76+
Step size used for calculating exponential backoff according to the formula: ``random.uniform(0, min(max, step * 2 ** attempt))``.
77+
78+
CRAWLERA_BACKOFF_MAX
79+
-----------------------
80+
81+
Default: ``180``
82+
83+
Max value for exponential backoff as showed in the formula above.

scrapy_crawlera/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
def exp_backoff(step, max):
88
""" Exponential backoff time with Full Jitter """
99
# this is a numerically stable version of
10-
# min(max, step * 2 ** attempt)
10+
# random.uniform(0, min(max, step * 2 ** attempt))
1111
max_attempts = math.log(max / step, 2)
1212
for attempt in count(0, 1):
1313
if attempt < max_attempts:

0 commit comments

Comments
 (0)