feat: 支持了watcher和timer的exclusive模式
This commit is contained in:
parent
aa8a45d147
commit
7feeac0d78
|
|
@ -12,6 +12,7 @@ export interface BBWatcher<ED extends EntityDict & BaseEntityDict, T extends key
|
|||
actionData: ActionData<ED, T> | (() => Promise<ActionData<ED, T>>);
|
||||
singleton?: true;
|
||||
lazy?: true;
|
||||
exclusive?: true;
|
||||
}
|
||||
export interface WBWatcher<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>> {
|
||||
type?: 'base';
|
||||
|
|
@ -23,6 +24,7 @@ export interface WBWatcher<ED extends EntityDict & BaseEntityDict, T extends key
|
|||
forUpdate?: true;
|
||||
singleton?: true;
|
||||
lazy?: true;
|
||||
exclusive?: true;
|
||||
}
|
||||
export interface WBFreeWatcher<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>> {
|
||||
type: 'free';
|
||||
|
|
@ -34,6 +36,7 @@ export interface WBFreeWatcher<ED extends EntityDict & BaseEntityDict, T extends
|
|||
forUpdate?: true;
|
||||
singleton?: true;
|
||||
lazy?: true;
|
||||
exclusive?: true;
|
||||
}
|
||||
export type Watcher<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>> = BBWatcher<ED, T> | WBWatcher<ED, T, Cxt> | WBFreeWatcher<ED, T, Cxt>;
|
||||
export {};
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ export interface BBWatcher<ED extends EntityDict & BaseEntityDict, T extends key
|
|||
actionData: ActionData<ED, T> | (() => Promise<ActionData<ED, T>>);
|
||||
singleton?: true; // 置singleton意味着在集群环境中只有一个进程会去执行
|
||||
lazy?: true; // 置lazy意味着在启动时不会立即执行,而是等到第一次调度时才执行
|
||||
exclusive?: true; // 置exclusive意味着在同一实例中不会并发处理同一条数据,而是抛出警告
|
||||
};
|
||||
|
||||
export interface WBWatcher<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>> {
|
||||
|
|
@ -27,6 +28,7 @@ export interface WBWatcher<ED extends EntityDict & BaseEntityDict, T extends key
|
|||
forUpdate?: true;
|
||||
singleton?: true; // 置singleton意味着在集群环境中只有一个进程会去执行
|
||||
lazy?: true; // 置lazy意味着在启动时不会立即执行,而是等到第一次调度时才执行
|
||||
exclusive?: true; // 置exclusive意味着在同一实例中不会并发处理同一条数据,而是抛出警告
|
||||
};
|
||||
|
||||
export interface WBFreeWatcher<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>> {
|
||||
|
|
@ -39,6 +41,7 @@ export interface WBFreeWatcher<ED extends EntityDict & BaseEntityDict, T extends
|
|||
forUpdate?: true;
|
||||
singleton?: true; // 置singleton意味着在集群环境中只有一个进程会去执行
|
||||
lazy?: true; // 置lazy意味着在启动时不会立即执行,而是等到第一次调度时才执行
|
||||
exclusive?: true; // 置exclusive意味着在同一实例中不会并发处理同一条数据,而是抛出警告
|
||||
};
|
||||
|
||||
export type Watcher<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends AsyncContext<ED>> = BBWatcher<ED, T> | WBWatcher<ED, T, Cxt> | WBFreeWatcher<ED, T, Cxt>;
|
||||
|
|
|
|||
Loading…
Reference in New Issue