Search
Preparing search index...
The search index is not available
@jerryc/concurrent-merger
Options
All
Public
Public/Protected
All
Inherited
Externals
Only exported
Menu
Globals
ConcurrentMerger
Class ConcurrentMerger
单任务队列
被修饰的函数,同一时间只允许执行一个异步请求。
在异步请求完成之前,其他调用请求会被进入队列。
异步请求完成之后,队列中的请求会被释放,共用同一个结果。
使用场景:高并发秒杀场景、刷新登录态场景等
Hierarchy
ConcurrentMerger
Index
Constructors
constructor
Properties
locked
name
queue
queue
Max
Length
Methods
add
Job
consume
All
AsFail
consume
All
AsSuccess
proxy
Constructors
constructor
new
Concurrent
Merger
(
__namedParameters
:
{
name
:
string
;
queueMaxLength
:
number
}
)
:
ConcurrentMerger
Parameters
__namedParameters:
{
name
:
string
;
queueMaxLength
:
number
}
name
:
string
queue
Max
Length
:
number
Returns
ConcurrentMerger
Properties
Private
locked
locked
:
boolean
= false
name
name
:
string
= "unnamed"
Private
queue
queue
:
Array
<
any
>
= []
queue
Max
Length
queue
Max
Length
:
number
= 100
Methods
Private
add
Job
add
Job
(
job
:
Array
<
any
>
)
:
void
Parameters
job:
Array
<
any
>
Returns
void
Private
consume
All
AsFail
consume
All
AsFail
(
error
:
any
)
:
void
Parameters
error:
any
Returns
void
Private
consume
All
AsSuccess
consume
All
AsSuccess
(
result
:
any
)
:
void
Parameters
result:
any
Returns
void
proxy
proxy
(
originMethods
:
(
...
any
:
any
[]
)
=>
Promise
<
any
>
)
:
(Anonymous function)
Parameters
originMethods:
(
...
any
:
any
[]
)
=>
Promise
<
any
>
(
...
any
:
any
[]
)
:
Promise
<
any
>
Parameters
Rest
...
any:
any
[]
Returns
Promise
<
any
>
Returns
(Anonymous function)
Globals
Concurrent
Merger
constructor
locked
name
queue
queue
Max
Length
add
Job
consume
All
AsFail
consume
All
AsSuccess
proxy
logger
concurrent
Merger
uuid
Generated using
TypeDoc
单任务队列
使用场景:高并发秒杀场景、刷新登录态场景等