GithubHelp home page GithubHelp logo

提交任务不阻塞 about ants HOT 3 CLOSED

panjf2000 avatar panjf2000 commented on August 28, 2024 3
提交任务不阻塞

from ants.

Comments (3)

choleraehyq avatar choleraehyq commented on August 28, 2024

这个需求很痛,现在如果想做熔断、限流一类的逻辑要在 pool 外面再包一层,其实完全可以在 pool 里做。

@panjf2000 我理解加个配置项,直接在 retrieveWorker 里面 reentry 那个分支判断一下然后返回 nil,Submit 里加一下对 retrieveWorker 返回值的判断就可以了?如果没什么问题我来搞一下

from ants.

panjf2000 avatar panjf2000 commented on August 28, 2024

大体思路应该是这样没错,我以前觉得熔断or限流这个逻辑应该在业务层实现,保持library的generality,不过好像有不少人都提出希望把这个feature加入到lib里,现在想想,熔断这个feature放到business或者放到library,貌似两个都能说得通。

So,你有时间的话提个PR吧,然后我再review一下,thanks~🤝

from ants.

choleraehyq avatar choleraehyq commented on August 28, 2024

这里我觉得应该在 pool 里实现,主要是因为目前 pool 没有任何接口能让我了解现在的拥塞状况,调用了 Submit 之后就直接卡在里面了;Running 和 Cap 之类的也不大准确,对于瞬间的突发流量没法用 Running 来衡量压力。

from ants.

Related Issues (20)

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.