mirror of
https://github.com/tdlight-team/tdlight-telegram-bot-api.git
synced 2024-12-25 04:05:52 +01:00
Improve MultiPromiseActorSafe usage.
This commit is contained in:
parent
014890d720
commit
6aa090a43a
@ -417,12 +417,15 @@ void ClientManager::hangup_shared() {
|
|||||||
|
|
||||||
void ClientManager::close_db() {
|
void ClientManager::close_db() {
|
||||||
LOG(WARNING) << "Closing databases";
|
LOG(WARNING) << "Closing databases";
|
||||||
td::MultiPromiseActorSafe mpromise("close binlogs");
|
td::MultiPromiseActorSafe mpas("close binlogs");
|
||||||
mpromise.add_promise(td::PromiseCreator::lambda(
|
mpas.add_promise(td::PromiseCreator::lambda(
|
||||||
[actor_id = actor_id(this)](td::Unit) { send_closure(actor_id, &ClientManager::finish_close); }));
|
[actor_id = actor_id(this)](td::Unit) { send_closure(actor_id, &ClientManager::finish_close); }));
|
||||||
|
mpas.set_ignore_errors(true);
|
||||||
|
|
||||||
parameters_->shared_data_->tqueue_->close(mpromise.get_promise());
|
auto lock = mpas.get_promise();
|
||||||
parameters_->shared_data_->webhook_db_->close(mpromise.get_promise());
|
parameters_->shared_data_->tqueue_->close(mpas.get_promise());
|
||||||
|
parameters_->shared_data_->webhook_db_->close(mpas.get_promise());
|
||||||
|
lock.set_value(td::Unit());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientManager::finish_close() {
|
void ClientManager::finish_close() {
|
||||||
|
Loading…
Reference in New Issue
Block a user