Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Clarify the documentation of DEPTH_PRIORITY further

Adrián Chavese108e3adbfa1
diff --git a/docs/topics/settings.rst b/docs/topics/settings.rst
index 0ac26a9bd..229a9e956 100644
--- a/docs/topics/settings.rst
+++ b/docs/topics/settings.rst
@@ -331,16 +331,16 @@ Default: ``0``
Scope: ``scrapy.spidermiddlewares.depth.DepthMiddleware``
-An integer that is used to adjust the request priority based on its depth:
+An integer that is used to adjust the :attr:`~scrapy.http.Request.priority` of
+a :class:`~scrapy.http.Request` based on its depth.
-- if zero (default), no priority adjustment is made from depth
-- **a positive value will decrease the priority, i.e. higher depth
- requests will be processed later** ; this is commonly used when doing
- breadth-first crawls (BFO)
-- a negative value will increase priority, i.e., higher depth requests
- will be processed sooner (DFO)
+The priority of a request is adjusted as follows::
-See also: :ref:`faq-bfo-dfo` about tuning Scrapy for BFO or DFO.
+ request.priority = request.priority - ( depth * DEPTH_PRIORITY )
+
+As depth increases, positive values of ``DEPTH_PRIORITY`` decrease request
+priority (BFO), while negative values increase request priority (DFO). See
+also :ref:`faq-bfo-dfo`.
.. note::