blockmine 1.1.8 → 1.1.9
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.
|
@@ -45,12 +45,21 @@ class BotManager {
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
if (TELEMETRY_ENABLED && STATS_SERVER_URL) {
|
|
48
|
-
setTimeout(() => this.sendHeartbeat(), 10000);
|
|
49
48
|
setInterval(() => this.sendHeartbeat(), 5 * 60 * 1000);
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
|
|
53
|
+
triggerHeartbeat() {
|
|
54
|
+
if (this.heartbeatDebounceTimer) {
|
|
55
|
+
clearTimeout(this.heartbeatDebounceTimer);
|
|
56
|
+
}
|
|
57
|
+
this.heartbeatDebounceTimer = setTimeout(() => {
|
|
58
|
+
this.sendHeartbeat();
|
|
59
|
+
}, 3000);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
54
63
|
_sendThrottledWarning(botId, username, warningType, message, typeChat = 'private') {
|
|
55
64
|
const cacheKey = `${botId}:${username}:${warningType}`;
|
|
56
65
|
const now = Date.now();
|
|
@@ -82,7 +91,6 @@ class BotManager {
|
|
|
82
91
|
return;
|
|
83
92
|
}
|
|
84
93
|
|
|
85
|
-
console.log(`[Telemetry] Подготовка к отправке heartbeat для ${runningBots.length} ботов...`);
|
|
86
94
|
|
|
87
95
|
const challengeRes = await fetch(`${STATS_SERVER_URL}/api/challenge?uuid=${instanceId}`);
|
|
88
96
|
if (!challengeRes.ok) {
|
|
@@ -109,7 +117,6 @@ class BotManager {
|
|
|
109
117
|
nonce: nonce
|
|
110
118
|
})
|
|
111
119
|
});
|
|
112
|
-
console.log(`[Telemetry] Heartbeat успешно отправлен.`);
|
|
113
120
|
|
|
114
121
|
} catch (error) {
|
|
115
122
|
console.error(`[Telemetry] Не удалось отправить heartbeat: ${error.message}`);
|
|
@@ -315,6 +322,8 @@ class BotManager {
|
|
|
315
322
|
|
|
316
323
|
this.bots.set(botConfig.id, child);
|
|
317
324
|
child.send({ type: 'start', config: fullBotConfig });
|
|
325
|
+
|
|
326
|
+
this.triggerHeartbeat();
|
|
318
327
|
|
|
319
328
|
this.appendLog(botConfig.id, '[SYSTEM] Проверка зависимостей пройдена. Запускаем процесс бота...');
|
|
320
329
|
return { success: true, message: 'Бот запускается' };
|