mirror of
https://gitee.com/openharmony/startup_appspawn
synced 2025-02-17 02:29:23 +00:00
!1506 modify cold start timeout
Merge pull request !1506 from 杨浩/0929timeout
This commit is contained in:
commit
86adf4321a
@ -569,9 +569,19 @@ static void WatchChildProcessFd(AppSpawningCtx *property)
|
||||
}
|
||||
}
|
||||
|
||||
static int IsChildColdRun(AppSpawningCtx *property)
|
||||
{
|
||||
return CheckAppMsgFlagsSet(property, APP_FLAGS_UBSAN_ENABLED)
|
||||
|| CheckAppMsgFlagsSet(property, APP_FLAGS_ASANENABLED)
|
||||
|| CheckAppMsgFlagsSet(property, APP_FLAGS_TSAN_ENABLED)
|
||||
|| CheckAppMsgFlagsSet(property, APP_FLAGS_HWASAN_ENABLED)
|
||||
|| (property->client.flags & APP_COLD_START);
|
||||
}
|
||||
|
||||
static int AddChildWatcher(AppSpawningCtx *property)
|
||||
{
|
||||
uint32_t timeout = GetSpawnTimeout(WAIT_CHILD_RESPONSE_TIMEOUT);
|
||||
uint32_t defTimeout = IsChildColdRun(property) ? COLD_CHILD_RESPONSE_TIMEOUT : WAIT_CHILD_RESPONSE_TIMEOUT;
|
||||
uint32_t timeout = GetSpawnTimeout(defTimeout);
|
||||
LE_WatchInfo watchInfo = {};
|
||||
watchInfo.fd = property->forkCtx.fd[0];
|
||||
watchInfo.flags = WATCHER_ONCE;
|
||||
@ -766,12 +776,9 @@ static bool IsSupportPrefork(AppSpawnContent *content, AppSpawnClient *client)
|
||||
}
|
||||
}
|
||||
AppSpawningCtx *property = (AppSpawningCtx *)client;
|
||||
bool isAsan = CheckAppMsgFlagsSet(property, APP_FLAGS_UBSAN_ENABLED)
|
||||
|| CheckAppMsgFlagsSet(property, APP_FLAGS_ASANENABLED)
|
||||
|| CheckAppMsgFlagsSet(property, APP_FLAGS_TSAN_ENABLED)
|
||||
|| CheckAppMsgFlagsSet(property, APP_FLAGS_HWASAN_ENABLED);
|
||||
if (content->mode == MODE_FOR_APP_SPAWN && !(client->flags & APP_COLD_START) && content->isPrefork
|
||||
&& !CheckAppMsgFlagsSet(property, APP_FLAGS_CHILDPROCESS) && !isAsan) {
|
||||
|
||||
if (content->mode == MODE_FOR_APP_SPAWN && !IsChildColdRun(property) && content->isPrefork
|
||||
&& !CheckAppMsgFlagsSet(property, APP_FLAGS_CHILDPROCESS)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -34,9 +34,11 @@ extern "C" {
|
||||
|
||||
#ifdef APPSPAWN_TEST
|
||||
#define MAX_WAIT_MSG_COMPLETE (5 * 100) // 500ms
|
||||
#define COLD_CHILD_RESPONSE_TIMEOUT 5
|
||||
#define WAIT_CHILD_RESPONSE_TIMEOUT 3 //3s
|
||||
#else
|
||||
#define MAX_WAIT_MSG_COMPLETE (5 * 1000) // 5s
|
||||
#define COLD_CHILD_RESPONSE_TIMEOUT 5
|
||||
#define WAIT_CHILD_RESPONSE_TIMEOUT 3 //3s
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user