Skip to content

Commit

Permalink
chore(budget): fix whitelist/blacklist budgeting
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Oct 25, 2024
1 parent fe995e8 commit 921d889
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 23 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion spider/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spider"
version = "2.10.23"
version = "2.10.24"
authors = [
"j-mendez <[email protected]>"
]
Expand Down
24 changes: 13 additions & 11 deletions spider/src/website.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,14 @@ impl Website {
pub fn is_allowed(&mut self, link: &CaseInsensitiveString) -> ProcessLinkStatus {
if self.links_visited.contains(link) {
ProcessLinkStatus::Blocked
} else if self.is_over_budget(link) {
ProcessLinkStatus::BudgetExceeded
} else {
self.is_allowed_default(link.inner())
let status = self.is_allowed_default(link.inner());

if status.eq(&ProcessLinkStatus::Allowed) && self.is_over_budget(link) {
ProcessLinkStatus::BudgetExceeded
} else {
status
}
}
}

Expand All @@ -373,15 +377,13 @@ impl Website {
pub fn is_allowed(&mut self, link: &CaseInsensitiveString) -> ProcessLinkStatus {
if self.links_visited.contains(link) {
ProcessLinkStatus::Blocked
} else if self.is_over_budget(&link) {
ProcessLinkStatus::BudgetExceeded
} else if self
.is_allowed_default(link)
.eq(&ProcessLinkStatus::Allowed)
{
ProcessLinkStatus::Allowed
} else {
ProcessLinkStatus::Blocked
let status = self.is_allowed_default(link);
if status.eq(&ProcessLinkStatus::Allowed) && self.is_over_budget(&link) {
ProcessLinkStatus::BudgetExceeded
} else {
status
}
}
}

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.10.23"
version = "2.10.24"
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.10.23"
version = "2.10.24"
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.10.23"
version = "2.10.24"
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.10.23"
version = "2.10.24"
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.10.23"
version = "2.10.24"
authors = [
"j-mendez <[email protected]>"
]
Expand Down

0 comments on commit 921d889

Please sign in to comment.