Ejemplo n.º 1
0
 private static void RemoveInstanceOnMaxFailure(IDictionary <string, int> failures, ServiceInstanceData instance,
                                                IInstanceRepository repository, ILogger logger)
 {
     if (failures[instance.InstanceId] == MaxFailures)
     {
         logger.LogInformation(
             $"Reached max health check failures ({MaxFailures}). Removing instance {JsonConvert.SerializeObject(instance)}.");
         repository.Remove(instance.InstanceId);
     }
 }
Ejemplo n.º 2
0
        public async Task <IActionResult> UnregisterAsync(string id)
        {
            _logger.LogInformation($"UnregisterAsync {id}");
            if (string.IsNullOrEmpty(id) || !_repository.Contains(id))
            {
                return(await Task.FromResult(BadRequest("Invalid ID.")));
            }

            _repository.Remove(id);
            return(await Task.FromResult(Ok("Unregistered")));
        }
Ejemplo n.º 3
0
        public void Remove(string netlist, string moduleName, string outputPort)
        {
            var instances = _instanceRepository.GetByModuleName(netlist, moduleName);

            foreach (var instance in instances)
            {
                if (instance.GetWire(outputPort).IsNullOrEmpty())
                {
                    _instanceRepository.Remove(instance);
                }
            }
        }
Ejemplo n.º 4
0
        private void RemoveBuffers(Module module, string bufferName, string inputPort, string outputPort)
        {
            var bufferIdsToBuffersMap = _instanceRepository.GetByHostModule(module.Netlist, module.Name)
                                        .Where(i => i.ModuleName == bufferName)
                                        .ToDictionary(i => i.Id, i => i);

            foreach (var bufferId in bufferIdsToBuffersMap.Keys.ToList())
            {
                var buffer = bufferIdsToBuffersMap[bufferId];
                if (_bufferWiringVerifier.IsPassThroughBuffer(module, buffer, inputPort, outputPort))
                {
                    continue;
                }

                _instanceRepository.Remove(buffer);

                var buffersToUpdate = ReplaceWires(module, inputPort, outputPort, buffer);
                foreach (var bufferToUpdate in buffersToUpdate)
                {
                    bufferIdsToBuffersMap[bufferToUpdate.Id] = bufferToUpdate;
                }
            }
        }