support to limit connections's number of different plan type, and cancel the support of task's special option
Pre-releaseMaybe the support of task's special option is a bad idea: because it will let developer to save more repeated opts in the queue, such as anonymous callback function, which is a waste to memory and is not easy be stored in redis in the future.
consider different needs of different types of plan to manage tasks' maxConne
ctions;
Cancel the support of task's special option, but task's special info
will be retained;
delete all of unit test about the support of task's special option.
Class Plan has been deleted and replaced by interface IPlan: all object implemented IPlan will been considered as a plan.
To count the different types' connections, add member currentConnections
to the _STATE
.
To flexibly limit the max number of connections, the option maxTotalConnections
has been deleted, and replaced by maxConnections
, which can be a number or a object([key: type]: number of connections).
Members type
and info
no longer belong to the plan's option, but belong to the plan object;
Only the task implemented ITask will been passed as a parameter to the plan's process function;
rewrite the timer callback and separated into some function;
adapt method plan
, retry
, queue
to the support of different types;
consider different needs of different types of plan to manage tasks' maxConne
ctions;
stored and managed tasks separately according different types of plans in the
Queue;
simiplify the api protocol in interface IQueue, IState and IDefaultOption;
adapt queue's unit test to different types of plan;
modify method getWaitingTaskNum
of class Queue;