fix: [CDE-316]: Increasing timeout for gitspace start/stop to 10m from 5m. (#2661)

* fix: [CDE-316]: Changing context of instance update to non-canceable context during gitspace start/stop.
* fix: [CDE-316]: Changing context of instance update to non-canceable context during gitspace start/stop.
* fix: [CDE-316]: Increasing timeout for gitspace start/stop to 10m from 5m.
CODE-2402
Dhruv Dhruv 2024-09-05 11:22:17 +00:00 committed by Harness
parent 744b884c1f
commit 1c8a47636f
1 changed files with 11 additions and 9 deletions

View File

@ -36,7 +36,7 @@ import (
const defaultPasswordRef = "harness_password"
const defaultMachineUser = "harness"
const gitspaceTimedOutInMintues = 5
const gitspaceTimedOutInMintues = 10
type ActionInput struct {
Action enum.GitspaceActionType `json:"action"`
@ -163,12 +163,6 @@ func (c *Controller) asyncOperation(
}
if orchestrateErr != nil {
config.GitspaceInstance.State = enum.GitspaceInstanceStateError
err := c.gitspaceSvc.UpdateInstance(ctxWithTimedOut, config.GitspaceInstance)
if err != nil {
log.Err(err).Msgf(
"failed to update gitspace instance during exec %q", config.GitspaceInstance.Identifier)
}
errChannel <- fmt.Errorf("failed to start/stop gitspace: %s %w", config.Identifier, orchestrateErr)
}
}
@ -197,11 +191,19 @@ func (c *Controller) submitAsyncOps(
}
if err != nil {
log.Err(err).Msgf("error during async execution for %s", config.GitspaceInstance.Identifier)
config.GitspaceInstance.State = enum.GitspaceInstanceStateError
updateErr := c.gitspaceSvc.UpdateInstance(submitCtx, config.GitspaceInstance)
if updateErr != nil {
log.Err(updateErr).Msgf(
"failed to update gitspace instance during exec %q", config.GitspaceInstance.Identifier)
}
switch action {
case enum.GitspaceActionTypeStart:
c.emitGitspaceConfigEvent(ttlExecuteContext, config, enum.GitspaceEventTypeGitspaceActionStartFailed)
c.emitGitspaceConfigEvent(submitCtx, config, enum.GitspaceEventTypeGitspaceActionStartFailed)
case enum.GitspaceActionTypeStop:
c.emitGitspaceConfigEvent(ttlExecuteContext, config, enum.GitspaceEventTypeGitspaceActionStopFailed)
c.emitGitspaceConfigEvent(submitCtx, config, enum.GitspaceEventTypeGitspaceActionStopFailed)
}
}