init TdDb in db thread

This commit is contained in:
Arseny Smirnov 2022-06-10 16:11:06 +02:00
parent f95f76c4de
commit 2171452e77

View File

@ -389,6 +389,17 @@ Status TdDb::init_sqlite(int32 scheduler_id, const TdParameters &parameters, con
}
void TdDb::open(int32 scheduler_id, TdParameters parameters, DbKey key, Promise<OpenedDatabase> &&promise) {
if (scheduler_id >= 0 && Scheduler::instance()->sched_id() != scheduler_id) {
class Worker final : public Actor {
public:
void open(TdParameters &&parameters, DbKey &&key, Promise<OpenedDatabase> &&promise) {
TdDb::open(-1, std::move(parameters), std::move(key), std::move(promise));
}
};
send_closure(create_actor_on_scheduler<Worker>("worker", scheduler_id), &Worker::open, std::move(parameters),
std::move(key), std::move(promise));
return;
}
OpenedDatabase result;
// Init pmc