gookit / event

📢 Lightweight event manager and dispatcher implements by Go. Go实现的轻量级的事件管理、调度程序库, 支持设置监听器的优先级, 支持使用通配符来进行一组事件的监听
https://pgk.go.dev/github.com/gookit/event
MIT License
513 stars 59 forks source link

Channels on Fire func #39

Closed AlexeySpiridonov closed 1 year ago

AlexeySpiridonov commented 1 year ago

The library is very good.

But I am interested in working under high load.

Have you thought about adding channel support to event.Fire()? That would be able to handle load peaks?

AlexeySpiridonov commented 1 year ago

I need handle more than 50 000 evens /sec

AlexeySpiridonov commented 1 year ago

Like AsyncFire but through channels?

inhere commented 1 year ago

@AlexeySpiridonov hi, add the feature on v1.1.0:


    // ChannelSize for fire events by goroutine
    ChannelSize int
    ConsumerNum int
(em *Manager) Async(name string, params M)
(em *Manager) FireC(name string, params M)
(em *Manager) FireAsync(e Event)

NOTE: should call the method Close() after exit program.