remove weight now that we use tiers
This commit is contained in:
parent
8ddfd111d5
commit
8c02e4420d
1
TODO.md
1
TODO.md
|
@ -299,6 +299,7 @@ These are not yet ordered. There might be duplicates. We might not actually need
|
||||||
- i think this was done, but am not positive.
|
- i think this was done, but am not positive.
|
||||||
- [x] if private txs are disabled, only send trasactions to some of our servers. we were DOSing ourselves with transactions and slowing down sync
|
- [x] if private txs are disabled, only send trasactions to some of our servers. we were DOSing ourselves with transactions and slowing down sync
|
||||||
- [x] retry if we get "the method X is not available"
|
- [x] retry if we get "the method X is not available"
|
||||||
|
- [x] remove weight. we don't use it anymore. tiers are what we use now
|
||||||
- [-] let users choose a % of reverts to log (or maybe x/second). someone like curve logging all reverts will be a BIG database very quickly
|
- [-] let users choose a % of reverts to log (or maybe x/second). someone like curve logging all reverts will be a BIG database very quickly
|
||||||
- this must be opt-in and spawned in the background since it will slow things down and will make their calls less private
|
- this must be opt-in and spawned in the background since it will slow things down and will make their calls less private
|
||||||
- [ ] automatic pruning of old revert logs once too many are collected
|
- [ ] automatic pruning of old revert logs once too many are collected
|
||||||
|
|
|
@ -1119,7 +1119,7 @@ impl Serialize for Web3Connection {
|
||||||
S: Serializer,
|
S: Serializer,
|
||||||
{
|
{
|
||||||
// 3 is the number of fields in the struct.
|
// 3 is the number of fields in the struct.
|
||||||
let mut state = serializer.serialize_struct("Web3Connection", 9)?;
|
let mut state = serializer.serialize_struct("Web3Connection", 8)?;
|
||||||
|
|
||||||
// the url is excluded because it likely includes private information. just show the name that we use in keys
|
// the url is excluded because it likely includes private information. just show the name that we use in keys
|
||||||
state.serialize_field("name", &self.name)?;
|
state.serialize_field("name", &self.name)?;
|
||||||
|
@ -1137,10 +1137,6 @@ impl Serialize for Web3Connection {
|
||||||
|
|
||||||
state.serialize_field("tier", &self.tier)?;
|
state.serialize_field("tier", &self.tier)?;
|
||||||
|
|
||||||
let faked_weight = 100u64.saturating_sub(self.tier) as f64 / 100.0;
|
|
||||||
|
|
||||||
state.serialize_field("weight", &faked_weight)?;
|
|
||||||
|
|
||||||
state.serialize_field("soft_limit", &self.soft_limit)?;
|
state.serialize_field("soft_limit", &self.soft_limit)?;
|
||||||
|
|
||||||
state.serialize_field(
|
state.serialize_field(
|
||||||
|
|
|
@ -512,11 +512,11 @@ impl Web3Connections {
|
||||||
if minimum < 0.0 {
|
if minimum < 0.0 {
|
||||||
available_request_map = available_request_map
|
available_request_map = available_request_map
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(rpc, weight)| {
|
.map(|(rpc, available_requests)| {
|
||||||
// TODO: is simple addition the right way to shift everyone?
|
// TODO: is simple addition the right way to shift everyone?
|
||||||
// TODO: probably want something non-linear
|
// TODO: probably want something non-linear
|
||||||
// minimum is negative, so we subtract
|
// minimum is negative, so we subtract to make available requests bigger
|
||||||
let x = weight - minimum;
|
let x = available_requests - minimum;
|
||||||
|
|
||||||
(rpc, x)
|
(rpc, x)
|
||||||
})
|
})
|
||||||
|
@ -530,12 +530,11 @@ impl Web3Connections {
|
||||||
} else {
|
} else {
|
||||||
let mut rng = thread_fast_rng::thread_fast_rng();
|
let mut rng = thread_fast_rng::thread_fast_rng();
|
||||||
|
|
||||||
// TODO: sort or weight the non-archive nodes to be first
|
|
||||||
usable_rpcs
|
usable_rpcs
|
||||||
.choose_multiple_weighted(&mut rng, usable_rpcs.len(), |rpc| {
|
.choose_multiple_weighted(&mut rng, usable_rpcs.len(), |rpc| {
|
||||||
*available_request_map
|
*available_request_map
|
||||||
.get(rpc)
|
.get(rpc)
|
||||||
.expect("rpc should always be in the weight map")
|
.expect("rpc should always be in available_request_map")
|
||||||
})
|
})
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
|
|
Loading…
Reference in New Issue