Use unlimited list instead slice of array #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
以前默认创建的 128 大小的 []_timer 数组,如果超过 128 大小后,append 内部会生成新的 []_timer 数组,导致之前 _timer 引用的 []_timer 中 index 位置不一定为正确的 *timer 。
我这是使用 container.list.List 对象来实现同样功能,不会因为里面对象的变更导致对列表的引用失效。
暂未做很严格以及性能测试,但前面描述的 bug 是很明确的。在我做压力测试因为会一瞬间建立比较多连接,就暴露出来了。