diff --git a/services/distributeddataservice/service/rdb/rdb_service_impl.cpp b/services/distributeddataservice/service/rdb/rdb_service_impl.cpp index c4123e29925d21a3569a41fcd9affee064ed5f8c..cbbf4c1f26b757f96696e2ae8cd7c6f9b9bae915 100644 --- a/services/distributeddataservice/service/rdb/rdb_service_impl.cpp +++ b/services/distributeddataservice/service/rdb/rdb_service_impl.cpp @@ -812,6 +812,20 @@ void RdbServiceImpl::SetReturnParam(StoreMetaData &metadata, RdbSyncerParam &par param.haMode_ = metadata.haMode; } +void RdbServiceImpl::SaveLaunchInfo(StoreMetaData &meta) +{ + RemoteChangeEvent::DataInfo info; + info.bundleName = meta.bundleName; + info.deviceId = meta.deviceId; + info.userId = meta.user; + if (executors_ != nullptr) { + executors_->Schedule(ExecutorPool::INVALID_DELAY, [dataInfo = std::move(info)]() mutable { + auto evt = std::make_unique(RemoteChangeEvent::RDB_META_SAVE, std::move(dataInfo)); + EventCenter::GetInstance().PostEvent(std::move(evt)); + }); + } +} + int32_t RdbServiceImpl::AfterOpen(const RdbSyncerParam ¶m) { XCollie xcollie(__FUNCTION__, XCollie::XCOLLIE_LOG | XCollie::XCOLLIE_RECOVERY); @@ -833,12 +847,7 @@ int32_t RdbServiceImpl::AfterOpen(const RdbSyncerParam ¶m) MetaDataManager::GetInstance().SaveMeta(meta.GetKey(), meta, true); AutoLaunchMetaData launchData; if (!MetaDataManager::GetInstance().LoadMeta(meta.GetAutoLaunchKey(), launchData, true)) { - RemoteChangeEvent::DataInfo info; - info.bundleName = meta.bundleName; - info.deviceId = meta.deviceId; - info.userId = meta.user; - auto evt = std::make_unique(RemoteChangeEvent::RDB_META_SAVE, std::move(info)); - EventCenter::GetInstance().PostEvent(std::move(evt)); + SaveLaunchInfo(meta); } } diff --git a/services/distributeddataservice/service/rdb/rdb_service_impl.h b/services/distributeddataservice/service/rdb/rdb_service_impl.h index da3d154cf4ec499fd54158409eab9411436e25f1..e58c6618f209888d123b6d7f72dd164984f99a8b 100755 --- a/services/distributeddataservice/service/rdb/rdb_service_impl.h +++ b/services/distributeddataservice/service/rdb/rdb_service_impl.h @@ -245,6 +245,8 @@ private: bool TryUpdateDeviceId(const RdbSyncerParam ¶m, const StoreMetaData &oldMeta, StoreMetaData &meta); + void SaveLaunchInfo(StoreMetaData &meta); + static Factory factory_; ConcurrentMap syncAgents_; std::shared_ptr executors_;