@gonzih/cc-tg 0.7.4 → 0.8.1
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/dist/notifier.js +10 -1
- package/package.json +1 -1
package/dist/notifier.js
CHANGED
|
@@ -41,10 +41,19 @@ export function writeChatLog(redis, namespace, msg) {
|
|
|
41
41
|
* @param handleUserMessage - Optional callback to feed UI messages into the active Claude session
|
|
42
42
|
*/
|
|
43
43
|
export function startNotifier(bot, chatId, namespace, redis, handleUserMessage) {
|
|
44
|
-
const sub = redis.duplicate(
|
|
44
|
+
const sub = redis.duplicate({
|
|
45
|
+
retryStrategy: (times) => {
|
|
46
|
+
const delay = Math.min(1000 * Math.pow(2, times - 1), 30_000);
|
|
47
|
+
log("info", `subscriber reconnecting in ${delay}ms (attempt ${times})`);
|
|
48
|
+
return delay;
|
|
49
|
+
},
|
|
50
|
+
});
|
|
45
51
|
sub.on("error", (err) => {
|
|
46
52
|
log("warn", "subscriber error:", err.message);
|
|
47
53
|
});
|
|
54
|
+
sub.on("close", () => {
|
|
55
|
+
log("info", "subscriber disconnected, will reconnect with backoff");
|
|
56
|
+
});
|
|
48
57
|
// cca:notify:{namespace} — forward job completion notifications to Telegram
|
|
49
58
|
sub.subscribe(`cca:notify:${namespace}`, (err) => {
|
|
50
59
|
if (err) {
|