Skip to content

Commit

Permalink
Hint at potential issues when switching reactors on existing projects (
Browse files Browse the repository at this point in the history
  • Loading branch information
Gallaecio authored Aug 7, 2023
1 parent 654aaba commit d3e7115
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,24 @@ To enable this plugin:
Scrapy setting to
``"twisted.internet.asyncioreactor.AsyncioSelectorReactor"``.

.. note:: On existing projects that were not using the asyncio Twisted
reactor, your existing code may need changes, such as:

- `Handling a pre-installed Twisted reactor
<https://docs.scrapy.org/en/latest/topics/asyncio.html#handling-a-pre-installed-reactor>`_.

Some Twisted imports install the default, non-asyncio Twisted
reactor as a side effect. Once a reactor is installed, it cannot be
changed for the whole run time.

- `Converting Twisted Deferreds into asyncio Futures
<https://docs.scrapy.org/en/latest/topics/asyncio.html#awaiting-on-deferreds>`_.

Note that you might be using Deferreds without realizing it through
some Scrapy functions and methods. For example, when you yield the
return value of ``self.crawler.engine.download()`` from a spider
callback, you are yielding a Deferred.

- Set `your Zyte API key
<https://docs.zyte.com/zyte-api/usage/general.html#authorization>`_ as
either the ``ZYTE_API_KEY`` Scrapy setting or as an environment variable of
Expand Down

0 comments on commit d3e7115

Please sign in to comment.