Skip to content

Commit

Permalink
chore: add workflow running key (#681)
Browse files Browse the repository at this point in the history
* chore: add workflow running key

* chore: add workflow event key
  • Loading branch information
tea-artist committed Jun 29, 2024
1 parent 9e5bbb6 commit 383b162
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 9 deletions.
1 change: 1 addition & 0 deletions apps/nestjs-backend/src/cache/cache.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export class CacheService {
async set<TKey extends keyof ICacheStore>(
key: TKey,
value: ICacheStore[TKey],
// seconds, and will add random 20-60 seconds
ttl?: number
): Promise<void> {
await this.cacheManager.set(key, value, ttl ? (ttl + getRandomInt(20, 60)) * 1000 : undefined);
Expand Down
2 changes: 2 additions & 0 deletions apps/nestjs-backend/src/cache/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export interface ICacheStore {
[key: `auth:session-expire:${string}`]: boolean;
[key: `oauth2:${string}`]: IOauth2State;
[key: `reset-password-email:${string}`]: IResetPasswordEmailCache;
[key: `workflow:running:${string}`]: string;
[key: `workflow:repeatKey:${string}`]: string;
}

export interface IAttachmentSignatureCache {
Expand Down
3 changes: 3 additions & 0 deletions apps/nestjs-backend/src/event-emitter/events/event.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,7 @@ export enum Events {

COLLABORATOR_CREATE = 'collaborator.create',
COLLABORATOR_DELETE = 'collaborator.delete',

WORKFLOW_ACTIVATE = 'workflow.activate',
WORKFLOW_DEACTIVATE = 'workflow.deactivate',
}
18 changes: 11 additions & 7 deletions apps/nestjs-backend/src/ws/ws.gateway.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,16 @@ export class DevWsGateway implements OnModuleInit, OnModuleDestroy {
}

onModuleDestroy() {
this.agents?.map((agent) => agent?.close());
this.shareDb.close();
this.server.close((err) => {
if (err) {
this.logger.error('DevWsGateway close error', err?.stack);
}
});
try {
this.agents?.map((agent) => agent?.close());
this.shareDb.close();
this.server.close((err) => {
if (err) {
this.logger.error('DevWsGateway close error', err?.stack);
}
});
} catch (err) {
this.logger.error('dev module close error: ' + (err as Error).message, (err as Error)?.stack);
}
}
}
3 changes: 2 additions & 1 deletion packages/common-i18n/src/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"rename": "Rename",
"change": "Change",
"upgrade": "Upgrade",
"search": "Search"
"search": "Search",
"loadMore": "Load more"
},
"quickAction": {
"title": "Quick Actions...",
Expand Down
3 changes: 2 additions & 1 deletion packages/common-i18n/src/locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"rename": "重命名",
"change": "变更",
"upgrade": "升级",
"search": "搜索"
"search": "搜索",
"loadMore": "加载更多"
},
"quickAction": {
"title": "快捷搜索...",
Expand Down

0 comments on commit 383b162

Please sign in to comment.