common-tg-service 1.1.87 → 1.1.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,11 +26,24 @@ export declare class BufferClientService implements OnModuleDestroy {
26
26
  private leaveChannelIntervalId;
27
27
  private isJoinChannelProcessing;
28
28
  private isLeaveChannelProcessing;
29
+ private activeTimeouts;
29
30
  private readonly JOIN_CHANNEL_INTERVAL;
30
31
  private readonly LEAVE_CHANNEL_INTERVAL;
31
32
  private readonly LEAVE_CHANNEL_BATCH_SIZE;
33
+ private readonly CLIENT_PROCESSING_DELAY;
34
+ private readonly CHANNEL_PROCESSING_DELAY;
35
+ private readonly MAX_MAP_SIZE;
36
+ private readonly CLEANUP_INTERVAL;
37
+ private cleanupIntervalId;
32
38
  constructor(bufferClientModel: Model<BufferClientDocument>, telegramService: TelegramService, usersService: UsersService, activeChannelsService: ActiveChannelsService, clientService: ClientService, channelsService: ChannelsService, promoteClientService: PromoteClientService, sessionService: SessionService);
33
39
  onModuleDestroy(): Promise<void>;
40
+ private cleanup;
41
+ private startMemoryCleanup;
42
+ private clearMemoryCleanup;
43
+ private performMemoryCleanup;
44
+ private createTimeout;
45
+ private clearAllTimeouts;
46
+ private checkMemoryHealth;
34
47
  create(bufferClient: CreateBufferClientDto): Promise<BufferClient>;
35
48
  findAll(status?: 'active' | 'inactive'): Promise<BufferClient[]>;
36
49
  findOne(mobile: string, throwErr?: boolean): Promise<BufferClient>;
@@ -40,16 +53,20 @@ export declare class BufferClientService implements OnModuleDestroy {
40
53
  search(filter: any): Promise<BufferClient[]>;
41
54
  executeQuery(query: any, sort?: any, limit?: number, skip?: number): Promise<BufferClient[]>;
42
55
  removeFromBufferMap(key: string): void;
56
+ private safeSetJoinChannelMap;
57
+ private safeSetLeaveChannelMap;
43
58
  clearBufferMap(): void;
44
59
  updateStatus(mobile: string, status: string, message?: string): Promise<BufferClient>;
45
60
  markAsInactive(mobile: string, reason: string): Promise<BufferClient>;
46
61
  updateInfo(): Promise<void>;
47
62
  joinchannelForBufferClients(skipExisting?: boolean): Promise<string>;
48
63
  joinChannelQueue(): Promise<void>;
64
+ private processJoinChannelSequentially;
49
65
  clearJoinChannelInterval(): void;
50
66
  removeFromLeaveMap(key: string): void;
51
67
  clearLeaveMap(): void;
52
68
  leaveChannelQueue(): Promise<void>;
69
+ private processLeaveChannelSequentially;
53
70
  clearLeaveChannelInterval(): void;
54
71
  setAsBufferClient(mobile: string, availableDate?: string): Promise<string>;
55
72
  checkBufferClients(): Promise<void>;