Git Product home page Git Product logo

Comments (4)

daixinkai avatar daixinkai commented on August 15, 2024

SteeltoeServiceDiscovery.cs

public IList<IServiceInstance> GetServiceInstances(string serviceId)
        {
            return _discoveryClient.GetInstances(serviceId).Select(s => new SteeltoeServiceInstance(s)).ToList<IServiceInstance>();
        }

这个函数有个bug
GetInstances返回节点的时候,没有过滤不健康的节点.
所以集群里有机器下线了,feign请求就有概率失败

默认启用了缓存,10分钟失效,是不是缓存未到期?
如果排除缓存的原因的话可以查查Steeltoe的文档,看看相关配置(比如过滤不健康节点)

from feign.net.

daixinkai avatar daixinkai commented on August 15, 2024

SteeltoeServiceDiscovery.cs

public IList<IServiceInstance> GetServiceInstances(string serviceId)
        {
            return _discoveryClient.GetInstances(serviceId).Select(s => new SteeltoeServiceInstance(s)).ToList<IServiceInstance>();
        }

这个函数有个bug
GetInstances返回节点的时候,没有过滤不健康的节点.
所以集群里有机器下线了,feign请求就有概率失败

试了一下,以consul为例:
"consul": {
"host": "xxxxxxx",
"port": "8500",
"discovery": {
"register": false,
"queryPassing": true
}
}
添加queryPassing=true可以过滤错误节点

from feign.net.

spacestime avatar spacestime commented on August 15, 2024

我使用了SteeltoeServiceDiscovery3.0.1

//Steeltoe
        services.AddDiscoveryClient(Configuration);
        //Feign
        services.AddFeignClients().AddSteeltoe();

第一个是可以访问服务,第二个不行,请问还需要配置什么吗?
[HttpGet("Get1")]
public async Task Get1()
{
var client = new HttpClient(_handler, false);
return await client.GetStringAsync("http://agent-service/weatherforecast");
}

    [HttpGet("Get")]
    public async Task<IEnumerable<WeatherForecast>> Get2()
    {
        return await this.AngleSharpTestService.GetHtmlAsync();
    }

from feign.net.

daixinkai avatar daixinkai commented on August 15, 2024

我使用了SteeltoeServiceDiscovery3.0.1

//Steeltoe
        services.AddDiscoveryClient(Configuration);
        //Feign
        services.AddFeignClients().AddSteeltoe();

第一个是可以访问服务,第二个不行,请问还需要配置什么吗?
[HttpGet("Get1")]
public async Task Get1()
{
var client = new HttpClient(_handler, false);
return await client.GetStringAsync("http://agent-service/weatherforecast");
}

    [HttpGet("Get")]
    public async Task<IEnumerable<WeatherForecast>> Get2()
    {
        return await this.AngleSharpTestService.GetHtmlAsync();
    }

请问报什么错呢?
SteeltoeServiceDiscovery 3.0 版本需要引入 Steeltoe.Discovery.Consul 3.0 或者 Steeltoe.Discovery.Eureka 3.0 才行

from feign.net.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.