feat: auto failover APIs with LK Cloud#1196
Merged
Merged
Conversation
Contributor
ChangesetThe following package versions will be affected by this PR:
|
ladvoc
approved these changes
Jul 2, 2026
| }; | ||
| } | ||
|
|
||
| #[tokio::test] |
Contributor
There was a problem hiding this comment.
suggestion(non-blocking): If capturing log output from these tests is desired, the test_log macro can be added: #[test_log::test(tokio::test)].
| region_urls: &mut Option<Vec<String>>, | ||
| attempted: &[String], | ||
| ) -> Option<Url> { | ||
| if region_urls.is_none() { |
Contributor
There was a problem hiding this comment.
suggestion: Consider using pattern matching to avoid unwrap:
let region_urls = match region_urls {
Some(urls) => urls,
None => region_urls.insert(failover::region_urls(original, forward).await),
};
failover::pick_next(region_urls, attempted)
cloudwebrtc
approved these changes
Jul 2, 2026
jhugman
reviewed
Jul 2, 2026
jhugman
left a comment
Collaborator
There was a problem hiding this comment.
Drive by review looking at idiomaticity. Feel free to ignore.
| } | ||
| } | ||
|
|
||
| /// Enables or disables region failover (enabled by default). Failover only |
Collaborator
There was a problem hiding this comment.
idiomatic: consider derive_builder here.
| const DISCOVERY_TIMEOUT: Duration = Duration::from_secs(2); | ||
|
|
||
| struct CacheEntry { | ||
| urls: Vec<String>, |
Collaborator
There was a problem hiding this comment.
idiomatic: consider using a Url, or at least a newtype for Url.
Comment on lines
+471
to
+493
| let request = proto::CreateSipParticipantRequest { | ||
| sip_trunk_id: sip_trunk_id.to_owned(), | ||
| trunk: outbound_trunk_config, | ||
| sip_call_to: call_to.to_owned(), | ||
| sip_number: options.sip_number.to_owned().unwrap_or_default(), | ||
| room_name: room_name.to_owned(), | ||
| participant_identity: options.participant_identity.to_owned(), | ||
| participant_name: options.participant_name.to_owned().unwrap_or_default(), | ||
| participant_metadata: options.participant_metadata.to_owned().unwrap_or_default(), | ||
| participant_attributes: options.participant_attributes.to_owned().unwrap_or_default(), | ||
| dtmf: options.dtmf.to_owned().unwrap_or_default(), | ||
| wait_until_answered, | ||
| play_ringtone: options.play_dialtone.unwrap_or(false), | ||
| play_dialtone: options.play_dialtone.unwrap_or(false), | ||
| hide_phone_number: options.hide_phone_number.unwrap_or(false), | ||
| max_call_duration: Self::duration_to_proto(options.max_call_duration), | ||
| ringing_timeout: Self::duration_to_proto(ringing_timeout), | ||
| krisp_enabled: options.enable_krisp.unwrap_or(false), | ||
| headers: options.headers.unwrap_or_default(), | ||
| include_headers: options.include_headers.map(|h| h as i32).unwrap_or_default(), | ||
| media_encryption: options.media_encryption.map(|e| e as i32).unwrap_or_default(), | ||
| ..Default::default() | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
retries in alternative datacenters on 5xx and transport failures