Skip to content

Commit 69651a5

Browse files
committed
fix: use priv fields
1 parent d68b02d commit 69651a5

File tree

1 file changed

+5
-16
lines changed
  • crates/services/gas_price_service/src/fuel_gas_price_updater/da_source_adapter

1 file changed

+5
-16
lines changed

crates/services/gas_price_service/src/fuel_gas_price_updater/da_source_adapter/service.rs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,6 @@ struct DaBlockCostsServiceSharedState {
5454
sender: Sender<DaBlockCosts>,
5555
}
5656

57-
impl DaBlockCostsServiceSharedState {
58-
pub fn subscribe(&self) -> Receiver<DaBlockCosts> {
59-
self.sender.subscribe()
60-
}
61-
62-
fn send(&self, da_block_costs: DaBlockCosts) -> Result<()> {
63-
self.sender.send(da_block_costs)?;
64-
Ok(())
65-
}
66-
}
67-
6857
const POLLING_INTERVAL_MS: u64 = 10_000;
6958
const DA_BLOCK_COSTS_BUFFER_SIZE: usize = 10;
7059

@@ -75,7 +64,7 @@ where
7564
Source: DaBlockCostsSource,
7665
{
7766
poll_interval: Interval,
78-
sender: DaBlockCostsServiceSharedState,
67+
shared: DaBlockCostsServiceSharedState,
7968
source: Source,
8069
cache: HashSet<DaBlockCosts>,
8170
}
@@ -88,7 +77,7 @@ where
8877
let (sender, _) = tokio::sync::broadcast::channel(DA_BLOCK_COSTS_BUFFER_SIZE);
8978
#[allow(clippy::arithmetic_side_effects)]
9079
Self {
91-
sender: DaBlockCostsServiceSharedState { sender },
80+
shared: DaBlockCostsServiceSharedState { sender },
9281
poll_interval: interval(
9382
poll_interval.unwrap_or(Duration::from_millis(POLLING_INTERVAL_MS)),
9483
),
@@ -119,7 +108,7 @@ where
119108
type TaskParams = ();
120109

121110
fn shared_data(&self) -> Self::SharedData {
122-
self.sender.clone()
111+
self.shared.clone()
123112
}
124113

125114
async fn into_task(
@@ -151,7 +140,7 @@ where
151140
let da_block_costs = self.source.request_da_block_cost().await?;
152141
if !self.cache.contains(&da_block_costs) {
153142
self.cache.insert(da_block_costs.clone());
154-
self.sender.send(da_block_costs)?;
143+
self.shared.sender.send(da_block_costs)?;
155144
}
156145
continue_running = true;
157146
}
@@ -171,7 +160,7 @@ pub fn new_provider<S: DaBlockCostsSource>(
171160
poll_interval: Option<Duration>,
172161
) -> DaBlockCostsProvider<S> {
173162
let handle = ServiceRunner::new(DaBlockCostsService::new(da_source, poll_interval));
174-
let subscription = handle.shared.subscribe();
163+
let subscription = handle.shared.sender.subscribe();
175164
DaBlockCostsProvider {
176165
handle,
177166
subscription,

0 commit comments

Comments
 (0)