Skip to content

Commit e227aa7

Browse files
authored
ref(apply): Avoid type erasing future on select (#363)
1 parent af31b5e commit e227aa7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

etl/src/replication/apply.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ use etl_config::shared::PipelineConfig;
22
use etl_postgres::replication::slots::get_slot_name;
33
use etl_postgres::replication::worker::WorkerType;
44
use etl_postgres::types::TableId;
5-
use futures::{FutureExt, StreamExt};
5+
use futures::StreamExt;
66
use metrics::histogram;
77
use postgres_replication::protocol;
88
use postgres_replication::protocol::{LogicalReplicationMessage, ReplicationMessage};
9-
use std::future::{Future, pending};
9+
use std::future::Future;
1010
use std::pin::Pin;
1111
use std::sync::Arc;
1212
use std::time::{Duration, Instant};
@@ -552,9 +552,9 @@ where
552552

553553
// PRIORITY 3: Handle table synchronization coordination signals.
554554
// Table sync workers signal when they complete initial data copying and are ready
555-
// to transition to continuous replication mode. We use map_or_else with pending()
556-
// to make this branch optional - if no signal receiver exists, this branch never fires.
557-
_ = force_syncing_tables_rx.as_mut().map_or_else(|| pending().boxed(), |rx| rx.changed().boxed()) => {
555+
// to transition to continuous replication mode. Guard the branch so it stays
556+
// dormant if no signal receiver was provided.
557+
_ = force_syncing_tables_rx.as_mut().unwrap().changed(), if force_syncing_tables_rx.is_some() => {
558558
// Table state transitions can only occur at transaction boundaries to maintain consistency.
559559
// If we're in the middle of processing a transaction (remote_final_lsn is set),
560560
// we defer the sync processing until the current transaction completes.

0 commit comments

Comments
 (0)