func()

in openwhisk/stopHandler.go [152:183]


func (serverAp *ActionProxy) timedDelete(actionCodeHash string) {
	innerAPValue, ok := serverAp.serverProxyData.actions[actionCodeHash]
	if !ok {
		return
	}

	if len(innerAPValue.connectedActionIDs) > 0 {
		return
	}

	timerDuration := timeToDeletion
	deleleTimerMs := os.Getenv("OW_DELETE_DURATION")
	if deleleTimerMs != "" {
		dur, err := time.ParseDuration(deleleTimerMs)
		if err != nil {
			Debug("Error parsing OW_DELETE_DURATION: %v", err)
		} else {
			timerDuration = dur
		}
	}

	Debug("Starting wait cycle for stopping hash '%s'", actionCodeHash)
	<-time.After(timerDuration)
	Debug("Ended wait cycle for stopping hash '%s'", actionCodeHash)

	if len(innerAPValue.connectedActionIDs) == 0 {
		stopAndDelete(serverAp, innerAPValue, actionCodeHash)
		return
	}

	Debug("Stopping request for hash '%s' skipped, as new actions joined.", actionCodeHash)
}