Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我想大量发模板消息,但send每次都等待返回太慢,有啥解决办法吗? #630

Closed
wilon opened this issue Mar 30, 2017 · 6 comments

Comments

@wilon
Copy link

wilon commented Mar 30, 2017

$result = $notice->uses($templateId)->withUrl($url)->andData($data)->andReceiver($userId)->send();

今天用了下一个小时发了不到2万条,领导要求10分钟发5万条。

有啥异步发送的办法吗?每次等待返回再发下一条太慢了。

@overtrue
Copy link
Collaborator

使用队列即可

@wilon
Copy link
Author

wilon commented Mar 31, 2017

有没有Laravel多线程队列的例子啊?
我用Laravel队列,还是一条一条执行。

@tianyong90
Copy link
Contributor

老实说模板消息不是这样用的,搞不好就被封号。客服消息、模板消息从业务上来说最好是”被动“的。当然,这样可能跟你问的技术无关了……

@wilon
Copy link
Author

wilon commented Apr 1, 2017

@tianyong90

确实,我也让产品好好看了微信文档。

但我是课程直播通知,产品要求必须发,现已经改成每天1万人...

@acgrid
Copy link
Contributor

acgrid commented Apr 4, 2017

多进程:写个通用CLI脚本,接受参数作为发送对象清单或范围。然后用shell或php的popen不阻塞的运行
多线程:如果平台支持,php有pthread扩展,自己实现吧

祝贵公众号早日被ban(逃)

@overtrue
Copy link
Collaborator

overtrue commented Apr 4, 2017

@acgrid 好坏好坏哈哈!:laughing:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants