當前位置: 首頁>>代碼示例>>Golang>>正文


Golang PendingStartMessage.LogDescription方法代碼示例

本文整理匯總了Golang中github.com/cloudfoundry/hm9000/models.PendingStartMessage.LogDescription方法的典型用法代碼示例。如果您正苦於以下問題:Golang PendingStartMessage.LogDescription方法的具體用法?Golang PendingStartMessage.LogDescription怎麽用?Golang PendingStartMessage.LogDescription使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/cloudfoundry/hm9000/models.PendingStartMessage的用法示例。


在下文中一共展示了PendingStartMessage.LogDescription方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: sendStartMessage

func (sender *Sender) sendStartMessage(startMessage models.PendingStartMessage) {
	messageToSend, shouldSend := sender.startMessageToSend(startMessage)
	if shouldSend {
		if sender.numberOfStartMessagesSent < sender.conf.SenderMessageLimit {
			sender.logger.Info("Sending message", startMessage.LogDescription())
			err := sender.messageBus.Publish(sender.conf.SenderNatsStartSubject, messageToSend.ToJSON())

			if err != nil {
				sender.logger.Error("Failed to send start message", err, startMessage.LogDescription())
				sender.didSucceed = false
				return
			}

			sender.sentStartMessages = append(sender.sentStartMessages, startMessage)

			if startMessage.KeepAlive == 0 {
				sender.queueStartMessageForDeletion(startMessage, "a sent start message with no keep alive")
			} else {
				sender.markStartMessageSent(startMessage)
			}

			sender.numberOfStartMessagesSent += 1
		}
	} else {
		sender.queueStartMessageForDeletion(startMessage, "start message that will not be sent")
	}
}
開發者ID:nkts,項目名稱:golang-devops-stuff,代碼行數:27,代碼來源:sender.go

示例2: appendStartMessageIfNotDuplicate

func (a *appAnalyzer) appendStartMessageIfNotDuplicate(message models.PendingStartMessage, loggingMessage string, additionalDetails map[string]string) (didAppend bool) {
	existingMessage, alreadyQueued := a.existingPendingStartMessages[message.StoreKey()]
	if !alreadyQueued {
		a.logger.Info(fmt.Sprintf("Enqueuing Start Message: %s", loggingMessage), message.LogDescription(), additionalDetails)
		a.startMessages[message.StoreKey()] = message
		return true
	} else {
		a.logger.Info(fmt.Sprintf("Skipping Already Enqueued Start Message: %s", loggingMessage), existingMessage.LogDescription(), additionalDetails)
		return false
	}
}
開發者ID:nkts,項目名稱:golang-devops-stuff,代碼行數:11,代碼來源:app_analyzer.go

示例3: startMessageToSend

func (sender *Sender) startMessageToSend(message models.PendingStartMessage) (models.StartMessage, bool) {
	messageToSend := models.StartMessage{
		MessageId:     message.MessageId,
		AppGuid:       message.AppGuid,
		AppVersion:    message.AppVersion,
		InstanceIndex: message.IndexToStart,
	}

	if message.SkipVerification {
		sender.logger.Info("Sending start message: message is marked with SkipVerification", message.LogDescription())
		return messageToSend, true
	}

	appKey := sender.store.AppKey(message.AppGuid, message.AppVersion)
	app, found := sender.apps[appKey]

	if !found {
		sender.logger.Info("Skipping sending start message: app is no longer desired", message.LogDescription())
		return models.StartMessage{}, false
	}

	if !app.IsDesired() {
		sender.logger.Info("Skipping sending start message: app is no longer desired", message.LogDescription(), app.LogDescription())
		return models.StartMessage{}, false
	}

	if !app.IsIndexDesired(message.IndexToStart) {
		sender.logger.Info("Skipping sending start message: instance index is beyond the desired # of instances", message.LogDescription(), app.LogDescription())
		return models.StartMessage{}, false
	}

	if app.HasStartingOrRunningInstanceAtIndex(message.IndexToStart) {
		sender.logger.Info("Skipping sending start message: instance is already running", message.LogDescription(), app.LogDescription())
		return models.StartMessage{}, false
	}

	sender.logger.Info("Sending start message: instance is not running at desired index", message.LogDescription(), app.LogDescription())
	return messageToSend, true
}
開發者ID:nkts,項目名稱:golang-devops-stuff,代碼行數:39,代碼來源:sender.go

示例4: queueStartMessageForDeletion

func (sender *Sender) queueStartMessageForDeletion(startMessage models.PendingStartMessage, reason string) {
	sender.logger.Info(fmt.Sprintf("Deleting %s", reason), startMessage.LogDescription())
	sender.startMessagesToDelete = append(sender.startMessagesToDelete, startMessage)
}
開發者ID:nkts,項目名稱:golang-devops-stuff,代碼行數:4,代碼來源:sender.go


注:本文中的github.com/cloudfoundry/hm9000/models.PendingStartMessage.LogDescription方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。