func (eni *ENIAttachment) StartTimer(timeoutFunc func()) error {
	eni.guard.Lock()
	defer eni.guard.Unlock()

	if eni.ackTimer != nil {
		// The timer has already been initialized, do nothing
		return nil
	}
	now := time.Now()
	duration := eni.ExpiresAt.Sub(now)
	if duration <= 0 {
		return errors.Errorf("eni attachment: timer expiration is in the past; expiration [%s] < now [%s]",
			eni.ExpiresAt.String(), now.String())
	}
	seelog.Infof("Starting ENI ack timer with duration=%s, %s", duration.String(), eni.stringUnsafe())
	eni.ackTimer = time.AfterFunc(duration, timeoutFunc)
	return nil
}
func (eni *ENIAttachment) StartTimer(timeoutFunc func()) error {
	eni.guard.Lock()
	defer eni.guard.Unlock()

	if eni.ackTimer != nil {
		// The timer has already been initialized, do nothing
		return nil
	}
	now := time.Now()
	duration := eni.ExpiresAt.Sub(now)
	if duration <= 0 {
		return errors.Errorf("eni attachment: timer expiration is in the past; expiration [%s] < now [%s]",
			eni.ExpiresAt.String(), now.String())
	}
	seelog.Infof("Starting ENI ack timer with duration=%s, %s", duration.String(), eni.stringUnsafe())
	eni.ackTimer = time.AfterFunc(duration, timeoutFunc)
	return nil
}
func ( eni * ENIAttachment ) StartTimer ( timeoutFunc func ( ) ) error { eni . guard . Lock ( ) defer eni . guard . Unlock ( ) if eni . ackTimer != nil { // The timer has already been initialized, do nothing return nil } now := time . Now ( ) duration := eni . ExpiresAt . Sub ( now ) if duration <= 0 { return errors . Errorf ( " " , eni . ExpiresAt . String ( ) , now . String ( ) ) } seelog . Infof ( " " , duration . String ( ) , eni . stringUnsafe ( ) ) eni . ackTimer = time . AfterFunc ( duration , timeoutFunc ) return nil }
// StartTimer starts the ack timer to record the expiration of ENI attachment
StartTimer starts the ack timer to record the expiration of ENI attachment