violetics 7.0.16-alpha → 7.0.17-alpha

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.
@@ -86,12 +86,12 @@ export const DEFAULT_CONNECTION_CONFIG = {
86
86
 
87
87
  // Memory management options
88
88
  maxMessagesPerChat: 2000,
89
- maxChats: 10000,
90
- maxContacts: 20000,
91
- messageCleanupIntervalMs: 5 * 60 * 1000, // 5 minutes
89
+ maxChats: 5000,
90
+ maxContacts: 10000,
91
+ messageCleanupIntervalMs: 2 * 60 * 1000, // 2 minutes
92
92
  maxHistoryCacheSize: 15000,
93
- bufferTimeoutMs: 30000,
94
- maxBufferCount: 10000
93
+ bufferTimeoutMs: 100,
94
+ maxBufferCount: 500
95
95
  };
96
96
  export const MEDIA_PATH_MAP = {
97
97
  image: '/mms/image',
@@ -30,7 +30,7 @@ export const makeChatsSocket = (config) => {
30
30
  let awaitingSyncTimeout;
31
31
  const placeholderResendCache = config.placeholderResendCache ||
32
32
  new LRUCache({
33
- max: 5000,
33
+ max: 250,
34
34
  ttl: DEFAULT_CACHE_TTLS.MSG_RETRY * 1000, // 1 hour
35
35
  allowStale: false
36
36
  });
@@ -19,25 +19,25 @@ export const makeMessagesRecvSocket = (config) => {
19
19
  const retryMutex = makeMutex();
20
20
  const msgRetryCache = config.msgRetryCounterCache ||
21
21
  new LRUCache({
22
- max: 10000,
22
+ max: 1000,
23
23
  ttl: DEFAULT_CACHE_TTLS.MSG_RETRY * 1000,
24
24
  allowStale: false
25
25
  });
26
26
  const callOfferCache = config.callOfferCache ||
27
27
  new LRUCache({
28
- max: 5000,
28
+ max: 500,
29
29
  ttl: DEFAULT_CACHE_TTLS.CALL_OFFER * 1000,
30
30
  allowStale: false
31
31
  });
32
32
  const placeholderResendCache = config.placeholderResendCache ||
33
33
  new LRUCache({
34
- max: 5000,
34
+ max: 250,
35
35
  ttl: DEFAULT_CACHE_TTLS.MSG_RETRY * 1000,
36
36
  allowStale: false
37
37
  });
38
38
  // Debounce identity-change session refreshes per JID to avoid bursts
39
39
  const identityAssertDebounce = new LRUCache({
40
- max: 1000,
40
+ max: 250,
41
41
  ttl: 10000,
42
42
  allowStale: false
43
43
  });
@@ -71,7 +71,7 @@ export const makeMessagesRecvSocket = (config) => {
71
71
  // metadata (LID details, timestamps, etc.) that the phone may omit
72
72
  await placeholderResendCache.set(messageKey?.id, msgData || true);
73
73
  }
74
- await delay(2000);
74
+ await delay(150);
75
75
  if (!(await placeholderResendCache.get(messageKey?.id))) {
76
76
  logger.debug({ messageKey }, 'message received while resend requested');
77
77
  return 'RESOLVED';
@@ -21,12 +21,12 @@ export const makeMessagesSocket = (config) => {
21
21
  const { ev, authState, messageMutex, signalRepository, upsertMessage, query, fetchPrivacySettings, sendNode, groupMetadata, groupToggleEphemeral } = sock;
22
22
  const userDevicesCache = config.userDevicesCache ||
23
23
  new LRUCache({
24
- max: 5000,
24
+ max: 500,
25
25
  ttl: DEFAULT_CACHE_TTLS.USER_DEVICES * 1000, // 5 minutes
26
26
  allowStale: false
27
27
  });
28
28
  const peerSessionsCache = new LRUCache({
29
- max: 5000,
29
+ max: 500,
30
30
  ttl: DEFAULT_CACHE_TTLS.USER_DEVICES * 1000,
31
31
  allowStale: false
32
32
  });
@@ -1389,7 +1389,7 @@ export const makeMessagesSocket = (config) => {
1389
1389
  : { is_group_status_mention: 'true' }
1390
1390
  }]
1391
1391
  });
1392
- await delay(2000);
1392
+ await delay(50);
1393
1393
  } catch (error) {
1394
1394
  logger.error(`Error sending status mention to ${id}: ${error}`);
1395
1395
  }
@@ -16,7 +16,7 @@ import { PreKeyManager } from './pre-key-manager.js';
16
16
  export function makeCacheableSignalKeyStore(store, logger, _cache) {
17
17
  const cache = _cache ||
18
18
  new LRUCache({
19
- max: 5000,
19
+ max: 500,
20
20
  ttl: DEFAULT_CACHE_TTLS.SIGNAL_STORE * 1000, // 5 minutes
21
21
  allowStale: false
22
22
  });
@@ -24,6 +24,7 @@ const BUFFERABLE_EVENT_SET = new Set(BUFFERABLE_EVENT);
24
24
  */
25
25
  export const makeEventBuffer = (logger, config = {}) => {
26
26
  const ev = new EventEmitter();
27
+ ev.setMaxListeners(0); // Unlock listener limit for multi-bot environments
27
28
  const historyCache = new Set();
28
29
  let data = makeBufferData();
29
30
  let isBuffering = false;
@@ -157,7 +158,7 @@ export const makeEventBuffer = (logger, config = {}) => {
157
158
  if (isBuffering && bufferCount === 1) {
158
159
  flush();
159
160
  }
160
- }, 100);
161
+ }, 10);
161
162
  activeBufferedTimeouts.add(t);
162
163
  }
163
164
  return result;
@@ -169,7 +170,7 @@ export const makeEventBuffer = (logger, config = {}) => {
169
170
  bufferCount = Math.max(0, bufferCount - 1);
170
171
  if (bufferCount === 0) {
171
172
  if (!flushPendingTimeout) {
172
- flushPendingTimeout = setTimeout(flush, 100);
173
+ flushPendingTimeout = setTimeout(flush, 10);
173
174
  }
174
175
  }
175
176
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "violetics",
3
3
  "type": "module",
4
- "version": "7.0.16-alpha",
4
+ "version": "7.0.17-alpha",
5
5
  "description": "A WebSockets library for interacting with WhatsApp Web",
6
6
  "keywords": [
7
7
  "whatsapp",