Add get_database_scheduler_id().
This commit is contained in:
parent
854b67d1e3
commit
1528cfb9da
@ -3647,6 +3647,12 @@ void Td::complete_pending_preauthentication_requests(const T &func) {
|
||||
}
|
||||
}
|
||||
|
||||
int32 Td::get_database_scheduler_id() {
|
||||
auto current_scheduler_id = Scheduler::instance()->sched_id();
|
||||
auto scheduler_count = Scheduler::instance()->sched_count();
|
||||
return min(current_scheduler_id + 1, scheduler_count - 1);
|
||||
}
|
||||
|
||||
void Td::start_init(uint64 id, string &&key) {
|
||||
VLOG(td_init) << "Begin to init database";
|
||||
init_request_id_ = id;
|
||||
@ -3654,10 +3660,7 @@ void Td::start_init(uint64 id, string &&key) {
|
||||
auto promise = PromiseCreator::lambda([actor_id = actor_id(this)](Result<TdDb::OpenedDatabase> r_opened_database) {
|
||||
send_closure(actor_id, &Td::init, std::move(r_opened_database));
|
||||
});
|
||||
auto current_scheduler_id = Scheduler::instance()->sched_id();
|
||||
auto scheduler_count = Scheduler::instance()->sched_count();
|
||||
TdDb::open(min(current_scheduler_id + 1, scheduler_count - 1), parameters_, as_db_key(std::move(key)),
|
||||
std::move(promise));
|
||||
TdDb::open(get_database_scheduler_id(), parameters_, as_db_key(std::move(key)), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::init(Result<TdDb::OpenedDatabase> r_opened_database) {
|
||||
|
@ -1426,6 +1426,8 @@ class Td final : public Actor {
|
||||
|
||||
static DbKey as_db_key(string key);
|
||||
|
||||
static int32 get_database_scheduler_id();
|
||||
|
||||
void start_init(uint64 id, string &&key);
|
||||
|
||||
void init(Result<TdDb::OpenedDatabase> r_opened_database);
|
||||
|
Loading…
x
Reference in New Issue
Block a user