Skip to content

Commit

Permalink
wait_until_first_data_arrives added to MyNoSqlDataReader
Browse files Browse the repository at this point in the history
  • Loading branch information
amigin committed Oct 4, 2023
1 parent c4a7d2a commit d286924
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
2 changes: 2 additions & 0 deletions my-no-sql-tcp-reader/src/subscribers/my_no_sql_data_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ pub trait MyNoSqlDataReader<TMyNoSqlEntity: MyNoSqlEntity + Sync + Send + 'stati
) -> GetEntityBuilder<TMyNoSqlEntity>;

async fn has_partition(&self, partition_key: &str) -> bool;

async fn wait_until_first_data_arrives(&self);
}
26 changes: 13 additions & 13 deletions my-no-sql-tcp-reader/src/subscribers/my_no_sql_data_reader_tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,19 +175,6 @@ where

result
}

pub async fn wait_until_first_data_arrives(&self) {
loop {
{
let reader = self.inner.data.read().await;
if reader.has_entities_at_all().await {
return;
}
}

tokio::time::sleep(Duration::from_millis(100)).await;
}
}
}

#[async_trait]
Expand Down Expand Up @@ -263,4 +250,17 @@ where
async fn has_partition(&self, partition_key: &str) -> bool {
self.has_partition(partition_key).await
}

async fn wait_until_first_data_arrives(&self) {
loop {
{
let reader = self.inner.data.read().await;
if reader.has_entities_at_all().await {
return;
}
}

tokio::time::sleep(Duration::from_millis(100)).await;
}
}
}

0 comments on commit d286924

Please sign in to comment.