diff options
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index ab6ede7..3ff30fb 100644 --- a/src/main.rs +++ b/src/main.rs | |||
| @@ -132,6 +132,24 @@ async fn main() -> Result<()> { | |||
| 132 | // Get a reference to the rejected events index for shutdown persistence | 132 | // Get a reference to the rejected events index for shutdown persistence |
| 133 | let shutdown_rejected_index = sync_manager.rejected_events_index(); | 133 | let shutdown_rejected_index = sync_manager.rejected_events_index(); |
| 134 | 134 | ||
| 135 | // Get a reference to the repo sync index for upgrading sync levels on promotion | ||
| 136 | let repo_sync_index = sync_manager.repo_sync_index(); | ||
| 137 | |||
| 138 | // Set the repo sync index on the write policy so user-submitted purgatory | ||
| 139 | // announcements can trigger relay discovery (connect to relays in announcement tags) | ||
| 140 | relay_with_db | ||
| 141 | .write_policy | ||
| 142 | .set_repo_sync_index(repo_sync_index.clone()); | ||
| 143 | |||
| 144 | // Get the action sender BEFORE consuming sync_manager with spawn | ||
| 145 | let action_tx = sync_manager.action_tx(); | ||
| 146 | |||
| 147 | // Set the sync action sender so the write policy can trigger relay connections | ||
| 148 | // when user-submitted purgatory announcements are registered with StateOnly level | ||
| 149 | if let Some(tx) = action_tx.clone() { | ||
| 150 | relay_with_db.write_policy.set_sync_action_tx(tx); | ||
| 151 | } | ||
| 152 | |||
| 135 | tokio::spawn(async move { | 153 | tokio::spawn(async move { |
| 136 | sync_manager.run().await; | 154 | sync_manager.run().await; |
| 137 | }); | 155 | }); |
| @@ -184,6 +202,8 @@ async fn main() -> Result<()> { | |||
| 184 | Some(config.domain.clone()), | 202 | Some(config.domain.clone()), |
| 185 | Some(relay_with_db.relay.clone()), | 203 | Some(relay_with_db.relay.clone()), |
| 186 | git_naughty_list.clone(), | 204 | git_naughty_list.clone(), |
| 205 | Some(repo_sync_index), | ||
| 206 | action_tx, | ||
| 187 | )); | 207 | )); |
| 188 | 208 | ||
| 189 | // Create throttle manager for rate limiting remote git servers | 209 | // Create throttle manager for rate limiting remote git servers |