Skip to content

Commit

Permalink
chore(website): add connect layer concurrency limit
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Dec 30, 2024
1 parent d5b69ce commit e5e0638
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 12 deletions.
15 changes: 9 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion spider/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spider"
version = "2.22.13"
version = "2.22.14"
authors = [
"j-mendez <[email protected]>"
]
Expand Down Expand Up @@ -67,6 +67,7 @@ tracing = { version = "0.1", default-features = false, features = ["std"], optio
sysinfo = { version = "0.33", default-features = false, features = ["system"], optional = true }
sqlx = { version = "0.8", features = [ "runtime-tokio", "sqlite" ], optional = true }
h2 = "0.4"
tower = { version = "0.5", features = ["limit"]}

[dependencies.spider_chrome]
version = "2"
Expand Down
13 changes: 13 additions & 0 deletions spider/src/website.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,13 @@ impl Website {
_ => client,
};

let client = match self.configuration.concurrency_limit {
Some(limit) => {
client.connector_layer(tower::limit::concurrency::ConcurrencyLimitLayer::new(limit))
}
_ => client,
};

self.configure_http_client_cookies(client)
}

Expand Down Expand Up @@ -1114,6 +1121,12 @@ impl Website {
};

let client = self.configure_http_client_cookies(client);
let client = match self.configuration.concurrency_limit {
Some(limit) => {
client.connector_layer(tower::limit::concurrency::ConcurrencyLimitLayer::new(limit))
}
_ => client,
};
let client = ClientBuilder::new(unsafe { client.build().unwrap_unchecked() });

if self.configuration.cache {
Expand Down
2 changes: 1 addition & 1 deletion spider_chrome/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spider_chrome"
version = "2.22.13"
version = "2.22.14"
rust-version = "1.70"
authors = [
"j-mendez <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion spider_cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spider_cli"
version = "2.22.13"
version = "2.22.14"
authors = [
"j-mendez <[email protected]>"
]
Expand Down
2 changes: 1 addition & 1 deletion spider_transformations/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spider_transformations"
version = "2.22.13"
version = "2.22.14"
authors = [
"j-mendez <[email protected]>"
]
Expand Down
2 changes: 1 addition & 1 deletion spider_utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spider_utils"
version = "2.22.13"
version = "2.22.14"
authors = [
"j-mendez <[email protected]>"
]
Expand Down
2 changes: 1 addition & 1 deletion spider_worker/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spider_worker"
version = "2.22.13"
version = "2.22.14"
authors = [
"j-mendez <[email protected]>"
]
Expand Down

0 comments on commit e5e0638

Please sign in to comment.