yumoqing 5238a08309 perf: log system - keep file handle open + async queue writes
- Replace open/write/flush/close per log call with persistent file handle
- Use threading.Queue + background daemon thread for non-blocking writes
- Only flush on exception/critical levels or periodically (every 1s idle)
- Queue full protection: drop oldest entry instead of blocking event loop
- Eliminates disk I/O blocking on slow storage (NFS/cloud disk) during high traffic
2026-05-26 13:18:47 +08:00
2025-10-05 11:23:33 +08:00
2025-07-16 11:09:20 +08:00
2025-07-16 11:09:20 +08:00
2025-07-16 11:09:20 +08:00
2026-05-15 16:19:58 +08:00
2026-03-27 13:23:15 +08:00

appPublic

a set of icommon modules for python development

EventDispatcher

生产级异步事件调度器。

特性

  • 支持普通函数
  • 支持 async 协程
  • 支持实例方法
  • 弱引用自动GC
  • 异常隔离
  • 超时控制
  • 自定义错误处理

使用示例

import asyncio

from event_dispatcher import EventDispatcher


def on_login(data):
    print(data)


async def main():

    dispatcher = EventDispatcher()

    dispatcher.bind(
        "login",
        on_login
    )

    await dispatcher.dispatch(
        "login",
        {
            "user": "张三"
        }
    )


asyncio.run(main())
Description
No description provided
Readme 839 KiB
Languages
Python 97.5%
Shell 2.5%