Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

race on gateway #403

Merged
merged 6 commits into from
Oct 24, 2022
Merged

race on gateway #403

merged 6 commits into from
Oct 24, 2022

Conversation

b5
Copy link
Member

@b5 b5 commented Oct 24, 2022

tried to make this as not-terrible as possible, by requiring an array of gateways, and randomly choosing a gateway when more than one is supplied.

@b5 b5 added the c-gateway label Oct 24, 2022
@b5 b5 added this to the v0.1.0 milestone Oct 24, 2022
@b5 b5 self-assigned this Oct 24, 2022
@@ -27,7 +27,9 @@ pub struct Config {
/// default port to listen on
pub port: u16,
/// flag to toggle whether the gateway should use denylist on requests
pub denylist: bool,
pub use_denylist: bool,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heads up @Arqu, I've added a use_ prefix to avoid using up the denylist configuration key on a boolean flag.

@b5 b5 marked this pull request as ready for review October 24, 2022 03:57
@b5 b5 requested a review from rklaehn October 24, 2022 10:43
rklaehn
rklaehn previously approved these changes Oct 24, 2022
1 => self
.http_resolvers
.first()
.ok_or_else(|| anyhow!("no gateway configured to fetch raw CIDs")),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can this ever happen? We have already checked that there is an element.

Can we just call rand all the time? It's not going to make a difference.

Copy link
Member Author

@b5 b5 Oct 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can this ever happen? We have already checked that there is an element.

yeah this is dumb. Will fix.

Can we just call rand all the time? It's not going to make a difference.

I was unclear on the overhead of the allocation, and didn't have time to research. I'll trust that you know this is a super low cost &. I'll just call it all the time 😄

iroh-resolver/src/racing.rs Outdated Show resolved Hide resolved
@b5
Copy link
Member Author

b5 commented Oct 24, 2022

cc @fabricedesre, this PR moves the racing gateway functionality into the "main" gateway, and changes the configuration location.

rklaehn
rklaehn previously approved these changes Oct 24, 2022
@b5 b5 merged commit 7b0a631 into main Oct 24, 2022
@b5 b5 deleted the b5/race_on_gateway branch October 26, 2022 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants