violetics 7.0.15-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.
- package/lib/Defaults/index.js +5 -5
- package/lib/Socket/chats.js +1 -1
- package/lib/Socket/messages-recv.js +8 -8
- package/lib/Socket/messages-send.js +3 -3
- package/lib/Utils/auth-utils.js +1 -1
- package/lib/Utils/event-buffer.js +3 -2
- package/lib/Utils/process-message.js +1 -1
- package/package.json +1 -1
package/lib/Defaults/index.js
CHANGED
|
@@ -86,12 +86,12 @@ export const DEFAULT_CONNECTION_CONFIG = {
|
|
|
86
86
|
|
|
87
87
|
// Memory management options
|
|
88
88
|
maxMessagesPerChat: 2000,
|
|
89
|
-
maxChats:
|
|
90
|
-
maxContacts:
|
|
91
|
-
messageCleanupIntervalMs:
|
|
89
|
+
maxChats: 5000,
|
|
90
|
+
maxContacts: 10000,
|
|
91
|
+
messageCleanupIntervalMs: 2 * 60 * 1000, // 2 minutes
|
|
92
92
|
maxHistoryCacheSize: 15000,
|
|
93
|
-
bufferTimeoutMs:
|
|
94
|
-
maxBufferCount:
|
|
93
|
+
bufferTimeoutMs: 100,
|
|
94
|
+
maxBufferCount: 500
|
|
95
95
|
};
|
|
96
96
|
export const MEDIA_PATH_MAP = {
|
|
97
97
|
image: '/mms/image',
|
package/lib/Socket/chats.js
CHANGED
|
@@ -30,7 +30,7 @@ export const makeChatsSocket = (config) => {
|
|
|
30
30
|
let awaitingSyncTimeout;
|
|
31
31
|
const placeholderResendCache = config.placeholderResendCache ||
|
|
32
32
|
new LRUCache({
|
|
33
|
-
max:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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(
|
|
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';
|
|
@@ -87,7 +87,7 @@ export const makeMessagesRecvSocket = (config) => {
|
|
|
87
87
|
setTimeout(async () => {
|
|
88
88
|
if (await placeholderResendCache.get(messageKey?.id)) {
|
|
89
89
|
logger.debug({ messageKey }, 'PDO message without response after 8 seconds. Phone possibly offline');
|
|
90
|
-
await placeholderResendCache.
|
|
90
|
+
await placeholderResendCache.delete(messageKey?.id);
|
|
91
91
|
}
|
|
92
92
|
}, 8000);
|
|
93
93
|
return sendPeerDataOperationMessage(pdoMessage);
|
|
@@ -297,7 +297,7 @@ export const makeMessagesRecvSocket = (config) => {
|
|
|
297
297
|
let retryCount = (await msgRetryCache.get(key)) || 0;
|
|
298
298
|
if (retryCount >= maxMsgRetryCount) {
|
|
299
299
|
logger.debug({ retryCount, msgId }, 'reached retry limit, clearing');
|
|
300
|
-
await msgRetryCache.
|
|
300
|
+
await msgRetryCache.delete(key);
|
|
301
301
|
return;
|
|
302
302
|
}
|
|
303
303
|
retryCount += 1;
|
|
@@ -1509,7 +1509,7 @@ export const makeMessagesRecvSocket = (config) => {
|
|
|
1509
1509
|
}
|
|
1510
1510
|
// delete data once call has ended
|
|
1511
1511
|
if (status === 'reject' || status === 'accept' || status === 'timeout' || status === 'terminate') {
|
|
1512
|
-
await callOfferCache.
|
|
1512
|
+
await callOfferCache.delete(call.id);
|
|
1513
1513
|
}
|
|
1514
1514
|
ev.emit('call', [call]);
|
|
1515
1515
|
await sendMessageAck(node);
|
|
@@ -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:
|
|
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:
|
|
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(
|
|
1392
|
+
await delay(50);
|
|
1393
1393
|
} catch (error) {
|
|
1394
1394
|
logger.error(`Error sending status mention to ${id}: ${error}`);
|
|
1395
1395
|
}
|
package/lib/Utils/auth-utils.js
CHANGED
|
@@ -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:
|
|
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
|
-
},
|
|
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,
|
|
173
|
+
flushPendingTimeout = setTimeout(flush, 10);
|
|
173
174
|
}
|
|
174
175
|
}
|
|
175
176
|
}
|
|
@@ -238,7 +238,7 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
|
|
|
238
238
|
const cachedData = msgId ? await placeholderResendCache?.get(msgId) : undefined;
|
|
239
239
|
//eslint-disable-next-line max-depth
|
|
240
240
|
if (msgId) {
|
|
241
|
-
await placeholderResendCache?.
|
|
241
|
+
await placeholderResendCache?.delete(msgId);
|
|
242
242
|
}
|
|
243
243
|
let finalMsg;
|
|
244
244
|
//eslint-disable-next-line max-depth
|