Skip to content

Commit

Permalink
delay_jitter_divisor is no longer configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Wilkerson-Barker committed Mar 14, 2024
1 parent cb2a1c3 commit 907c20f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/realm.h
Original file line number Diff line number Diff line change
Expand Up @@ -3650,8 +3650,6 @@ RLM_API void realm_sync_client_config_set_max_resumption_delay_interval(realm_sy
uint64_t) RLM_API_NOEXCEPT;
RLM_API void realm_sync_client_config_set_resumption_delay_backoff_multiplier(realm_sync_client_config_t*,
int) RLM_API_NOEXCEPT;
RLM_API void realm_sync_client_config_set_resumption_delay_jitter_divisor(realm_sync_client_config_t*,
int) RLM_API_NOEXCEPT;
RLM_API void realm_sync_client_config_set_sync_socket(realm_sync_client_config_t*,
realm_sync_socket_t*) RLM_API_NOEXCEPT;
RLM_API void realm_sync_client_config_set_default_binding_thread_observer(
Expand Down
6 changes: 0 additions & 6 deletions src/realm/object-store/c_api/sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,6 @@ RLM_API void realm_sync_client_config_set_resumption_delay_backoff_multiplier(re
config->timeouts.reconnect_backoff_info.resumption_delay_backoff_multiplier = multiplier;
}

RLM_API void realm_sync_client_config_set_resumption_delay_jitter_divisor(realm_sync_client_config_t* config,
int divisor) noexcept
{
config->timeouts.reconnect_backoff_info.delay_jitter_divisor = divisor;
}

/// Register an app local callback handler for bindings interested in registering callbacks before/after
/// the ObjectStore thread runs for this app. This only works for the default socket provider implementation.
/// IMPORTANT: If a function is supplied that handles the exception, it must call abort() or cause the
Expand Down
9 changes: 6 additions & 3 deletions src/realm/object-store/sync/impl/sync_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,16 @@ struct SyncClient {
c.pong_keepalive_timeout = config.timeouts.pong_keepalive_timeout;
if (config.timeouts.fast_reconnect_limit > 1000)
c.fast_reconnect_limit = config.timeouts.fast_reconnect_limit;
c.reconnect_backoff_info = config.timeouts.reconnect_backoff_info;
c.reconnect_backoff_info.resumption_delay_interval =
config.timeouts.reconnect_backoff_info.resumption_delay_interval;
c.reconnect_backoff_info.max_resumption_delay_interval =
config.timeouts.reconnect_backoff_info.max_resumption_delay_interval;
c.reconnect_backoff_info.resumption_delay_backoff_multiplier =
config.timeouts.reconnect_backoff_info.resumption_delay_backoff_multiplier;
if (c.reconnect_backoff_info.resumption_delay_interval.count() < 1000)
logger->info("A resumption delay interval less than 1000 (1 second) is not recommended");
if (c.reconnect_backoff_info.resumption_delay_backoff_multiplier < 1)
throw InvalidArgument("Delay backoff multiplier in reconnect backoff info cannot be less than 1");
if (c.reconnect_backoff_info.delay_jitter_divisor < 0)
throw InvalidArgument("Delay jitter divisor in reconnect backoff info cannot be less than 0");
return c;
}())
, m_logger_ptr(logger)
Expand Down
1 change: 1 addition & 0 deletions src/realm/object-store/sync/sync_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ struct SyncClientTimeouts {
uint64_t pong_keepalive_timeout;
uint64_t fast_reconnect_limit;
// Used for requesting location metadata at startup and reconnecting sync connections.
// NOTE: delay_jitter_divisor is not configurable
sync::ResumptionDelayInfo reconnect_backoff_info;
};

Expand Down
2 changes: 0 additions & 2 deletions test/object-store/c_api/c_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,6 @@ TEST_CASE("C API (non-database)", "[c_api]") {
600024);
realm_sync_client_config_set_resumption_delay_backoff_multiplier(test_sync_client_config.get(), 1010);
CHECK(test_sync_client_config->timeouts.reconnect_backoff_info.resumption_delay_backoff_multiplier == 1010);
realm_sync_client_config_set_resumption_delay_jitter_divisor(test_sync_client_config.get(), 212);
CHECK(test_sync_client_config->timeouts.reconnect_backoff_info.delay_jitter_divisor == 212);
}

SECTION("realm_app_config_t") {
Expand Down

0 comments on commit 907c20f

Please sign in to comment.