dataShareHelper创建添加等待参数

Signed-off-by: 侯志雄 <houzhixiong1@h-partners.com>
This commit is contained in:
侯志雄 2024-10-30 11:24:12 +08:00
parent c41cb6d287
commit 53e27b03a3

View File

@ -394,7 +394,7 @@ void CheckDataShareHelper(napi_env env, const napi_value context,
SETTING_LOG_INFO("settingsnapi : getDataShareHelper resultset == nullptr, strUri %{public}s %{public}d", SETTING_LOG_INFO("settingsnapi : getDataShareHelper resultset == nullptr, strUri %{public}s %{public}d",
strUri.c_str(), strUri.c_str(),
trial); trial);
dataShareHelper = OHOS::DataShare::DataShareHelper::Creator(contextS->GetToken(), strUri); dataShareHelper = OHOS::DataShare::DataShareHelper::Creator(contextS->GetToken(), strUri, waitTime = 5);
} while (trial++ < DB_HELPER_TRIAL_NUMBER && dataShareHelper == nullptr); } while (trial++ < DB_HELPER_TRIAL_NUMBER && dataShareHelper == nullptr);
if (resultset != nullptr) { if (resultset != nullptr) {
resultset->Close(); resultset->Close();
@ -426,7 +426,7 @@ std::shared_ptr<DataShareHelper> getDataShareHelper(
return dataShareHelper; return dataShareHelper;
} }
dataShareHelper = OHOS::DataShare::DataShareHelper::Creator(contextS->GetToken(), strProxyUri, strUri); dataShareHelper = OHOS::DataShare::DataShareHelper::Creator(contextS->GetToken(), strProxyUri, strUri, waitTime = 5);
SETTING_LOG_INFO("g_D_S_H Creator called, valid %{public}d", dataShareHelper != nullptr); SETTING_LOG_INFO("g_D_S_H Creator called, valid %{public}d", dataShareHelper != nullptr);
return dataShareHelper; return dataShareHelper;
} }