mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-06-02 00:57:41 +08:00
WeCom requires the callback HTTP response within ~5s, otherwise it retries the same notification. The previous code ran sync_msg pulling synchronously inside Query.POST, so a backlog could exceed the deadline and trigger retries that race on the same cursor and end up replying to the same user multiple times. - Dispatch consume_callback to a background ThreadPoolExecutor and return 'success' immediately from the HTTP handler. - Serialize work per open_kfid with a lock so retried/concurrent callbacks queue up instead of racing the cursor window. - Shutdown the executor on channel stop().