Example #1
0
func (instance *LeverInstance) monitorInstanceLock(levInstResourceID string) {
	err := scale.WaitResource(leverutil.ServiceFlag.Get(), levInstResourceID)
	if err != nil {
		instance.logger.WithFields("err", err).Debug("Instance lock error")
	}

	instance.lock.Lock()
	defer instance.lock.Unlock()
	if instance.closing {
		return
	}
	instance.logger.Info("Instance lock expired")
	instance.closeInternal(true)
}
Example #2
0
func (resource *LeverResource) monitorResourceLock(levResResourceID string) {
	err := scale.WaitResource(leverutil.ServiceFlag.Get(), levResResourceID)
	if err != nil {
		resource.logger.WithFields("err", err).Debug("Resource lock error")
	}

	resource.lock.Lock()
	defer resource.lock.Unlock()
	if resource.closing {
		return
	}
	resource.logger.Info("Resource lock expired")
	resource.closeInternal(false)
}
Example #3
0
func (tracker *FleetTracker) monitorServiceResource(servingID string) {
	err := scale.WaitResource(FleetTrackerService, servingID)
	if err != nil {
		logger.WithFields("err", err).Error(
			"Error monitoring fleettracker resource")
	}
	// Expired.
	tracker.lock.Lock()
	defer tracker.lock.Unlock()
	loadTracker, ok := tracker.services[servingID]
	if !ok {
		return
	}
	loadTracker.Close()
	delete(tracker.services, servingID)
}