Giter Club home page Giter Club logo

Comments (6)

a67793581 avatar a67793581 commented on June 3, 2024 1

可以参考 这个实现 https://github.com/asaskevich/EventBus
这个库非常精简,但是作者已经停止了维护。

from event.

inhere avatar inhere commented on June 3, 2024

具体点呢?要api更新那些东西

from event.

xiaofeige avatar xiaofeige commented on June 3, 2024

比如使用AsyncFire的实现是直接起一个go-routine去异步执行,但是这种方式导致服务热重启的时候感知不到这里有没有未执行完的任务。建议event对外提供一个WatiGroup可以允许外部热重启的地方执行wait操作。

from event.

zhangsean avatar zhangsean commented on June 3, 2024

就是要实现一个服务计数器对吧?请求来的时候+1,请求完成-1,请求计数0的时候才允许热重启。

from event.

xiaofeige avatar xiaofeige commented on June 3, 2024

你可以用 waitgroup去实现。

from event.

inhere avatar inhere commented on June 3, 2024

@xiaofeige @a67793581 v1.1.0+ 版本已经添加了简单的实现。
可以使用 Async/FireC/FireAsync 方法触发事件,事件将会写入 chan 异步消费。可以使用 CloseWait() 关闭chan并等待事件全部消费完成。

from event.

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.