Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

Better logging in ProxyChain.shutdown()

Jan Curn3c45fa36b2f7
diff --git a/src/proxy_chain.js b/src/proxy_chain.js
index ec69fd249..6899df784 100644
--- a/src/proxy_chain.js
+++ b/src/proxy_chain.js
@@ -256,9 +256,11 @@ cache_peer_access my_peer allow all
* @return {*}
*/
shutdown() {
- console.log(`Shutting down proxy chain ${this._getChildProxyUrl()} => ${this._getParentProxyUrl()} (Squid pid: ${this.squidPid})`); // eslint-disable-line max-len
+ const isRunning = this._isSquidRunning();
- if (this._isSquidRunning()) {
+ console.log(`Shutting down proxy chain ${this._getChildProxyUrl()} => ${this._getParentProxyUrl()} (Squid pid: ${this.squidPid}, running: ${isRunning})`); // eslint-disable-line max-len
+
+ if (isRunning) {
try {
process.kill(this.squidPid, 'SIGKILL');
} catch (err) {