Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ you can provide custom homeservers, too.
It will start with a full-sync of the room state, so depending on the size of
your matrix account(s), this may take a moment.

Optional `timeout` (in seconds) can be added.
## Changelog

**Unreleased**
Expand Down
13 changes: 11 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ struct Args {
#[arg(long, env = "TO_HOMESERVER")]
to_homeserver: Option<OwnedServerName>,

/// Custom timeout for syncing, default is 10 secs
#[arg(long, env = "TIMEOUT")]
timeout: Option<u64>,

/// Custom logging info
#[arg(long, env = "RUST_LOG", default_value = "matrix_migrate=info")]
log: String,
Expand Down Expand Up @@ -85,11 +89,16 @@ async fn main() -> anyhow::Result<()> {

info!("All logged in. Syncing...");

let sync_settings = if let Some(s) = args.timeout {
SyncSettings::default().timeout(Duration::from_secs(s))
} else {
SyncSettings::default()
};
let to_c_stream = to_c.clone();
let to_sync_stream = to_c_stream.sync_stream(SyncSettings::default()).await;
let to_sync_stream = to_c_stream.sync_stream(sync_settings.clone()).await;
pin_mut!(to_sync_stream);

try_join!(from_c.sync_once(SyncSettings::default()), async {
try_join!(from_c.sync_once(sync_settings.clone()), async {
to_sync_stream.next().await.unwrap()
})?;

Expand Down