diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-22 14:23:46 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-22 14:23:46 +0000 |
| commit | 541f34a207047b26547154e7d631005d456f12fd (patch) | |
| tree | 446cffc4b3bbc32bf61933b5ab41a044a35d6f3b /src/sync/relay_connection.rs | |
| parent | b10a6cc91dab4c3d83d62fe8cb357c78f2cd4d1e (diff) | |
sync: add req rate-limit detection and cooldown
Diffstat (limited to 'src/sync/relay_connection.rs')
| -rw-r--r-- | src/sync/relay_connection.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/sync/relay_connection.rs b/src/sync/relay_connection.rs index 5a61777..d69e1ce 100644 --- a/src/sync/relay_connection.rs +++ b/src/sync/relay_connection.rs | |||
| @@ -27,6 +27,8 @@ pub enum RelayEvent { | |||
| 27 | Event(Event, SubscriptionId), | 27 | Event(Event, SubscriptionId), |
| 28 | /// End of stored events for a subscription | 28 | /// End of stored events for a subscription |
| 29 | EndOfStoredEvents(SubscriptionId), | 29 | EndOfStoredEvents(SubscriptionId), |
| 30 | /// NOTICE message from relay | ||
| 31 | Notice(String), | ||
| 30 | /// Connection was closed | 32 | /// Connection was closed |
| 31 | Closed(String), | 33 | Closed(String), |
| 32 | /// Shutdown notification | 34 | /// Shutdown notification |
| @@ -238,6 +240,11 @@ impl RelayConnection { | |||
| 238 | break; | 240 | break; |
| 239 | } | 241 | } |
| 240 | } | 242 | } |
| 243 | RelayMessage::Notice(msg) => { | ||
| 244 | tracing::debug!(relay = %url, message = %msg, "Received NOTICE"); | ||
| 245 | let _ = event_sender.send(RelayEvent::Notice(msg.to_string())).await; | ||
| 246 | // Don't break - continue processing events | ||
| 247 | } | ||
| 241 | RelayMessage::Closed { message: msg, .. } => { | 248 | RelayMessage::Closed { message: msg, .. } => { |
| 242 | tracing::info!(relay = %url, message = %msg, "Relay closed subscription"); | 249 | tracing::info!(relay = %url, message = %msg, "Relay closed subscription"); |
| 243 | let _ = | 250 | let _ = |