Commit Graph

156 Commits

Author SHA1 Message Date
Andy Pan 7be597c9e8 chore: code cleanup 2023-06-09 00:14:11 +08:00
Andy Pan b32591f8bd opt: awake blocking goroutines more precisely in purgeStaleWorkers
Fixes #272
2023-04-15 23:47:55 +08:00
Andy Pan 73defa0289 chore: rename the internal method in workerQueue 2023-04-04 13:01:14 +08:00
Andy Pan 4b495fd500 chore: code cleanup 2023-03-23 18:18:52 +08:00
Andy Pan e425c7b917 chore: rename the field 'recycleTime' of worker to 'lastUsed' 2023-03-23 15:18:56 +08:00
Andy Pan 0313effc53 opt: refactor the worker queue for reusability and readability of code 2023-03-23 12:28:47 +08:00
Andy Pan 711cad9624 chore: reorganize the structure of internal packages 2023-02-19 22:46:33 +08:00
Andy Pan 88d2454bbb fix: resolve the build failures 2022-12-20 22:29:21 +08:00
Andy Pan b6eaea118b opt: refine some code 2022-12-20 22:09:35 +08:00
Andy Pan 858f91f48b chore: code cleanup 2022-12-20 21:55:28 +08:00
Gleb Radchenko 23c4f48d0d fix: exit ticktock goroutine when pool is closed 2022-12-20 21:15:34 +08:00
Andy Pan 846d76a437 opt: cache current time for workders and update it periodically 2022-12-11 19:49:58 +08:00
Andy Pan b604f7dc64 opt: fix the timeout error of ReleaseTimeout() with DisablePurge=true and improve tests 2022-10-11 22:52:13 +08:00
zhenshan.cao 8b106abaf3
Add option to turn off automatically purge (#253)
Fixes #252 

Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>
2022-10-11 21:16:04 +08:00
Andy Pan 9310acdff2 feat: implement pool.Waiting() API
Fixes #157
2022-05-07 22:43:25 +08:00
Andy Pan 15f3cdfb7b opt: refine ReleaseTimeout() 2022-05-06 20:27:08 +08:00
Andy Pan 96d074234a Add a new method -- ReleaseTimeout() for waiting all workers to exit
Fixes #212
2022-03-08 16:28:12 +08:00
codingfanlt fbd17036db
Awake the blocking callers when Tune(size int) is invoked to expand the pool (#210)
Fixes #205
2022-02-14 21:51:40 +08:00
Andy Pan 8d03fcf77f Fix the bug that blocks forever when call Release() before all tasks are done
Fixes #202
2022-02-08 13:53:21 +08:00
Andy Pan fdb318c1d7 Remove the unused error type and update some comments 2021-11-24 00:42:50 +08:00
Andy Pan 91b12588db Add comments about calling Submit()/Invoke() from Submit()/Invoke()
Fixes #197
2021-11-23 23:57:03 +08:00
Zhening Li f62e8ab1e0
style: fixed some typos in the comments (#184)
* style: fixed some typos in the comments

* style: add space between en and zh words

Co-authored-by: Zhening <18501262663@163.com>
2021-09-13 11:57:25 +08:00
Andy Pan 8ab8c9f899 Improve some comments 2021-05-23 20:23:43 +08:00
Andy Pan a2ad870d2d Returns -1 from Free() by unlimited pool
Fixes #152
2021-04-27 08:18:51 +08:00
Andy Pan dbcb6a104f Fix an issue that blocks all waiting callers when all workers panic
Fixes #146 #147
2021-03-28 22:37:56 +08:00
Andy Pan e01348e424 Fix a bug from the previous commit
Updates #141
2021-03-19 01:21:14 +08:00
Andy Pan 36c4272286 Fix a bug that blocks callers infinitely
Fixes #141
2021-03-18 21:42:54 +08:00
Z 94a7a7f1cb
fix: Memory leak (#114)
Fixes #113
2020-10-15 11:35:55 +08:00
thinkgo ef60172172
Avoid memory leak (#107) 2020-08-29 18:51:56 +08:00
Andy Pan 001c8b5e1b Update READMEs and comments 2020-08-12 20:49:20 +08:00
Andy Pan ad86bfa6d2 Improve the unlimited pool
Updates #90
2020-05-27 22:26:39 +08:00
Andy Pan 1c534853c8 Support unlimited pool
Fixes #90
2020-05-08 23:24:26 +08:00
Andy Pan e507ae340f Support customized logger 2020-03-13 00:02:19 +08:00
l d8cb036198
Fix a bug that doesn't release lock (#79) 2020-02-26 11:15:02 +08:00
Andy Pan d32d668565 Add a feature of rebooting a released pool 2020-01-16 23:45:15 +08:00
Andy Pan 3bfc4f2ebd sync.Pool opt 2019-10-24 22:32:12 +08:00
Andy Pan 7aaa4349f5 Optimize loop queue of workers 2019-10-20 18:38:11 +08:00
Andy Pan 52b301019a Fix typos and add comments 2019-10-15 14:50:38 +08:00
Andy Pan 5ecbdf4bf2 Make optimization to Pool and PoolWithFunc struct 2019-10-10 22:28:21 +08:00
Andy Pan 566511ec5f Refactoring to the interface and implementations of worker-array 2019-10-10 03:02:04 +08:00
Kevin Bai f0e23928f4 add loop queue (#53)
* add loop queue

* add loop queue

* fix the bugs

add loop queue

move the worker queue to directory

按照新的接口实现 lifo 队列

添加新接口的环形队列实现

rename the slice queue

修复了 unlock

使用 queue 管理 goWorkerWithFunc

使用 dequeue 判断队列

add remainder

增加测试文件

循环队列需要一个空闲位

* remove interface{}

* Refine the logic of sync.Pool

* Add flowcharts of ants into READMEs

* Add the installation about ants v2

* Renew the functional options in READMEs

* Renew English and Chinese flowcharts

* rename package name

移动 worker queue 位置

worker queue 都修改为私有接口

考虑到性能问题,把 interface{} 改回到  *goworker

* 修改 releaseExpiry 和 releaseAll

* remove files

* fix some bug
2019-10-10 00:59:19 +08:00
Andy Pan b1cf2ff445 Refine the logic of sync.Pool 2019-10-06 02:02:40 +08:00
Andy Pan b0ec5102cc Refactoring 2019-10-04 11:24:13 +08:00
Andy Pan e73db1d7d2 Replace mutex with spin-lock 2019-09-27 20:51:46 +08:00
Andy Pan 89644d035c Remove some useless code 2019-09-03 09:29:26 +08:00
Andy Pan 44aec9954f A little bit of optimization in periodicallyPurge() 2019-08-25 17:41:49 +08:00
Andy Pan cbf8ddf048 Fixed #45 and Releasing v2 module 2019-08-25 14:26:14 +08:00
Andy Pan 201ac20358 Add functional options pattern for ants 2019-08-25 14:14:18 +08:00
Andy Pan d1b4e8b163 🍻Refine the `Pool.Release()` Method 2019-08-25 14:14:18 +08:00
Cholerae Hu 444711e79f support nonblocking submit and max blocking limit setting
Signed-off-by: Cholerae Hu <choleraehyq@gmail.com>
2019-08-25 14:14:18 +08:00