MCPcopy
hub / github.com/scrapy/scrapy / close_async

Method close_async

scrapy/core/engine.py:249–261  ·  view source on GitHub ↗

Gracefully close the execution engine. If it has already been started, stop it. In all cases, close the spider and the downloader.

(self)

Source from the content-addressed store, hash-verified

247 return deferred_from_coro(self.close_async())
248
249 async def close_async(self) -> None:
250 """
251 Gracefully close the execution engine.
252 If it has already been started, stop it. In all cases, close the spider and the downloader.
253 """
254 if self.running:
255 await self.stop_async() # will also close spider and downloader
256 elif self.spider is not None:
257 await self.close_spider_async(
258 reason="shutdown"
259 ) # will also close downloader
260 elif hasattr(self, "downloader"):
261 self.downloader.close()
262
263 def pause(self) -> None:
264 self.paused = True

Callers 5

closeMethod · 0.95
test_close_downloaderMethod · 0.95
crawlMethod · 0.80
crawl_asyncMethod · 0.80
startMethod · 0.80

Calls 3

stop_asyncMethod · 0.95
close_spider_asyncMethod · 0.95
closeMethod · 0.45

Tested by 2

test_close_downloaderMethod · 0.76
startMethod · 0.64