Skip to content

[BUG] 并发度计算忽略了BatchCount,导致资源隔离异常 #556

Open
@Levi-Hope

Description

@Levi-Hope

Issue Description

Type: bug report

Describe what happened

并发度计算忽略了BatchCount,但资源隔离考虑了BatchCount,这样会导致资源隔离逻辑出现异常。
比如说IsolationRule阈值为10,调用4次sentinel.Entry("abc", sentinel.WithBatchCount(8)),返回结果是:
Pass
Pass
Pass
Block
在第4次Entry才会返回Block,之前的3次Entry都Pass了,通过资源24个,相当于漏限12个资源。

Describe what you expected to happen

并发度计算需要考虑BatchCount。
在上面那个例子里,第2次Entry就应该Block住。

How to reproduce it (as minimally and precisely as possible)

我在 这里 里补了一个集成测试,这个测试可以复现。

Tell us your environment

Anything else we need to know?

已提PR #557

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions