Move DcAuthManager to main session scheduler.
This commit is contained in:
parent
6c4804b591
commit
7c3e9e6d5e
@ -174,10 +174,9 @@ Status NetQueryDispatcher::wait_dc_init(DcId dc_id, bool force) {
|
|||||||
int32 upload_session_count = (raw_dc_id != 2 && raw_dc_id != 4) || is_premium ? 8 : 4;
|
int32 upload_session_count = (raw_dc_id != 2 && raw_dc_id != 4) || is_premium ? 8 : 4;
|
||||||
int32 download_session_count = is_premium ? 8 : 2;
|
int32 download_session_count = is_premium ? 8 : 2;
|
||||||
int32 download_small_session_count = is_premium ? 8 : 2;
|
int32 download_small_session_count = is_premium ? 8 : 2;
|
||||||
int32 main_session_scheduler_id = G()->use_sqlite_pmc() ? -1 : G()->get_database_scheduler_id();
|
|
||||||
dc.main_session_ = create_actor_on_scheduler<SessionMultiProxy>(
|
dc.main_session_ = create_actor_on_scheduler<SessionMultiProxy>(
|
||||||
PSLICE() << "SessionMultiProxy:" << raw_dc_id << ":main", main_session_scheduler_id, session_count, auth_data,
|
PSLICE() << "SessionMultiProxy:" << raw_dc_id << ":main", get_main_session_scheduler_id(), session_count,
|
||||||
true, raw_dc_id == main_dc_id_, use_pfs, false, false, is_cdn);
|
auth_data, true, raw_dc_id == main_dc_id_, use_pfs, false, false, is_cdn);
|
||||||
dc.upload_session_ = create_actor_on_scheduler<SessionMultiProxy>(
|
dc.upload_session_ = create_actor_on_scheduler<SessionMultiProxy>(
|
||||||
PSLICE() << "SessionMultiProxy:" << raw_dc_id << ":upload", slow_net_scheduler_id, upload_session_count,
|
PSLICE() << "SessionMultiProxy:" << raw_dc_id << ":upload", slow_net_scheduler_id, upload_session_count,
|
||||||
auth_data, false, false, use_pfs, false, true, is_cdn);
|
auth_data, false, false, use_pfs, false, true, is_cdn);
|
||||||
@ -295,14 +294,18 @@ bool NetQueryDispatcher::get_use_pfs() {
|
|||||||
return G()->get_option_boolean("use_pfs") || get_session_count() > 1;
|
return G()->get_option_boolean("use_pfs") || get_session_count() > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32 NetQueryDispatcher::get_main_session_scheduler_id() {
|
||||||
|
return G()->use_sqlite_pmc() ? -1 : G()->get_database_scheduler_id();
|
||||||
|
}
|
||||||
|
|
||||||
NetQueryDispatcher::NetQueryDispatcher(const std::function<ActorShared<>()> &create_reference) {
|
NetQueryDispatcher::NetQueryDispatcher(const std::function<ActorShared<>()> &create_reference) {
|
||||||
auto s_main_dc_id = G()->td_db()->get_binlog_pmc()->get("main_dc_id");
|
auto s_main_dc_id = G()->td_db()->get_binlog_pmc()->get("main_dc_id");
|
||||||
if (!s_main_dc_id.empty()) {
|
if (!s_main_dc_id.empty()) {
|
||||||
main_dc_id_ = to_integer<int32>(s_main_dc_id);
|
main_dc_id_ = to_integer<int32>(s_main_dc_id);
|
||||||
}
|
}
|
||||||
LOG(INFO) << tag("main_dc_id", main_dc_id_.load(std::memory_order_relaxed));
|
|
||||||
delayer_ = create_actor<NetQueryDelayer>("NetQueryDelayer", create_reference());
|
delayer_ = create_actor<NetQueryDelayer>("NetQueryDelayer", create_reference());
|
||||||
dc_auth_manager_ = create_actor<DcAuthManager>("DcAuthManager", create_reference());
|
dc_auth_manager_ =
|
||||||
|
create_actor_on_scheduler<DcAuthManager>("DcAuthManager", get_main_session_scheduler_id(), create_reference());
|
||||||
public_rsa_key_watchdog_ = create_actor<PublicRsaKeyWatchdog>("PublicRsaKeyWatchdog", create_reference());
|
public_rsa_key_watchdog_ = create_actor<PublicRsaKeyWatchdog>("PublicRsaKeyWatchdog", create_reference());
|
||||||
sequence_dispatcher_ = MultiSequenceDispatcher::create("MultiSequenceDispatcher");
|
sequence_dispatcher_ = MultiSequenceDispatcher::create("MultiSequenceDispatcher");
|
||||||
|
|
||||||
|
@ -85,6 +85,7 @@ class NetQueryDispatcher {
|
|||||||
Status wait_dc_init(DcId dc_id, bool force);
|
Status wait_dc_init(DcId dc_id, bool force);
|
||||||
bool is_dc_inited(int32 raw_dc_id);
|
bool is_dc_inited(int32 raw_dc_id);
|
||||||
|
|
||||||
|
static int32 get_main_session_scheduler_id();
|
||||||
static int32 get_session_count();
|
static int32 get_session_count();
|
||||||
static bool get_use_pfs();
|
static bool get_use_pfs();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user