Andy Pan
Andy Pan
I don't quite get your point, what did you want to ask exactly? Is your question related to this issue? if not, please open your own issue. @davidxiaozhi
Sorry, `interface{}` is for generic use cases, and why would it cause large memory allocation?
有点像 #55 #56 ,按你的设想,优先队列无非就是每次先尝试从高优先队列取 worker,没有的话是等待还是降级到低一级队列去取?按照 ants 现在的架构,引入优先队列没有意义,因为不管是从高优先队列还是普通队列里取出 worker,都是直接去提交运行了,并没有优先的概念。 还有,为什么你说的用多个 pool 满足不了你的需求?为什么一定要在一个 pool 里实现优先调度?
我猜你想说的是在 worker struct 里加优先的队列吧?worker 每次先尝试从优先 channel 里取任务执行?
1. 关于优先级任务的性质:我还是觉得这个和 #55 #56 一样偏向于业务需求,本质上来讲不属于 goroutine pool 的职责范围; 2. 关于优先级任务的实现:就算最后要做这个功能,我也不赞同通过引入多个队列来实现,这种做法太粗糙且会极大增加代码复杂度(多个队列多个锁),我目前想到的比较合理的方案是利用 `Priority Queue` 来实现,现在 ants 的 workers 已经抽象成接口了,可以通过实现这个[接口](https://github.com/panjf2000/ants/blob/master/worker_array.go#L16-L23)来完成。
> 我自己的理解,默认1s过期的情况下,可能会导致有些worker的回收时间延迟1s 这个结论你是怎么得出来的?
5ms 的误差看起来不算很大(不过如果你的 worker 数量很大就另当别论了),但是要保证队列里的时间是单调递增的,不然就可能有潜在问题。
Please don't put the description in the issue title directly, which makes the issue title tedious. Figure out the difference between title and description and put them in the right...
It's unnecessary to use `ants` in `fasthttp` because there is already a [goroutine pool](https://github.com/valyala/fasthttp/blob/master/workerpool.go) in `fasthttp` which is also the prototype of `ants`, so using `ants` with `fasthttp` makes no...