Skip to content

Commit

Permalink
try without the new dep
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-savu committed Jun 27, 2024
1 parent 21080b8 commit 4aca1e2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 20 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion ethers-middleware/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ serde = { version = "1.0.124", default-features = false, features = ["derive"] }
thiserror = { version = "1.0", default-features = false }
futures-util = { version = "^0.3" }
futures-locks = { version = "0.7", default-features = false }
futures-channel.workspace = "0.2.9"
tracing = { version = "0.1.37", default-features = false }
tracing-futures = { version = "0.2.5", default-features = false }

Expand Down
26 changes: 8 additions & 18 deletions ethers-middleware/src/gas_escalator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub use linear::LinearGasPrice;

use async_trait::async_trait;

use futures_channel::oneshot;
// use futures_channel::oneshot;
use futures_util::{lock::Mutex, select_biased};
use instant::Instant;
use std::{pin::Pin, sync::Arc};
Expand Down Expand Up @@ -60,7 +60,7 @@ pub(crate) struct GasEscalatorMiddlewareInternal<M> {
/// The transactions which are currently being monitored for escalation
#[allow(clippy::type_complexity)]
pub txs: ToEscalate,
_background: oneshot::Sender<()>,
// _background: oneshot::Sender<()>,
}

/// A Gas escalator allows bumping transactions' gas price to avoid getting them
Expand Down Expand Up @@ -192,18 +192,18 @@ where
E: GasEscalator + 'static,
M: 'static,
{
let (tx, rx) = oneshot::channel();
// let (tx, rx) = oneshot::channel();
let inner = Arc::new(inner);

let txs: ToEscalate = Default::default();

let this = Arc::new(GasEscalatorMiddlewareInternal {
inner: inner.clone(),
txs: txs.clone(),
_background: tx,
// _background: tx,
});

let esc = EscalationTask { inner, escalator, frequency, txs, shutdown: rx };
let esc = EscalationTask { inner, escalator, frequency, txs };

{
spawn(esc.escalate().instrument(tracing::debug_span!("gas-escalation")));
Expand All @@ -220,19 +220,13 @@ pub struct EscalationTask<M, E> {
escalator: E,
frequency: Frequency,
txs: ToEscalate,
shutdown: oneshot::Receiver<()>,
// shutdown: oneshot::Receiver<()>,
}

#[cfg(not(target_arch = "wasm32"))]
impl<M, E> EscalationTask<M, E> {
pub fn new(
inner: M,
escalator: E,
frequency: Frequency,
txs: ToEscalate,
shutdown: oneshot::Receiver<()>,
) -> Self {
Self { inner, escalator, frequency, txs, shutdown }
pub fn new(inner: M, escalator: E, frequency: Frequency, txs: ToEscalate) -> Self {
Self { inner, escalator, frequency, txs }
}

async fn escalate(mut self) -> Result<(), GasEscalatorError<M>>
Expand All @@ -256,10 +250,6 @@ impl<M, E> EscalationTask<M, E> {

loop {
select_biased! {
_ = &mut self.shutdown => {
tracing::debug!("Shutting down escalation task, middleware has gone away");
return Ok(())
}
opt = watcher.next() => {
if opt.is_none() {
tracing::error!("timing future has gone away");
Expand Down

0 comments on commit 4aca1e2

Please sign in to comment.