Skip to content

Commit 39d4867

Browse files
committed
changefeeds: improve logging
1 parent 4ed7429 commit 39d4867

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/packages/nats/changefeed/server.ts

+10-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { waitUntilConnected } from "@cocalc/nats/util";
1414
import { delay } from "awaiting";
1515
import { getMaxPayload } from "@cocalc/nats/util";
1616

17-
export const DEFAULT_LIFETIME = 2 * 1000 * 60;
17+
export const DEFAULT_LIFETIME = 1000 * 60;
1818
export const MAX_LIFETIME = 15 * 1000 * 60;
1919
export const MIN_LIFETIME = 30 * 1000;
2020
export const MIN_HEARTBEAT = 5000;
@@ -240,8 +240,15 @@ async function handleMessage(mesg, db) {
240240
};
241241

242242
if (numChangefeedsPerAccount[account_id] > MAX_CHANGEFEEDS_PER_ACCOUNT) {
243+
logger.debug(
244+
`numChangefeedsPerAccount[${account_id}] >= MAX_CHANGEFEEDS_PER_ACCOUNT`,
245+
{
246+
numChangefeedsPerAccountThis: numChangefeedsPerAccount[account_id],
247+
MAX_CHANGEFEEDS_PER_ACCOUNT,
248+
},
249+
);
243250
respond(
244-
`There is a limit of ${MAX_CHANGEFEEDS_PER_ACCOUNT} changefeeds per account`,
251+
`This server has a limit of ${MAX_CHANGEFEEDS_PER_ACCOUNT} changefeeds per account`,
245252
);
246253
return;
247254
}
@@ -253,7 +260,7 @@ async function handleMessage(mesg, db) {
253260
// this will just cause the client to make another attempt, hopefully
254261
// to another server
255262
respond(
256-
`There is a limit of ${MAX_CHANGEFEEDS_PER_SERVER} changefeeds per server`,
263+
`This server has a limit of ${MAX_CHANGEFEEDS_PER_SERVER} changefeeds`,
257264
);
258265
return;
259266
}

src/packages/sync/table/changefeed-nats2.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { changefeed, renew } from "@cocalc/nats/changefeed/client";
88
import { delay } from "awaiting";
99
import { waitUntilConnected } from "@cocalc/nats/util";
1010

11-
const LIFETIME = 90000;
11+
const LIFETIME = 60000;
1212
const HEARTBEAT = 15000;
1313
const HEARTBEAT_MISS_THRESH = 7500;
1414

0 commit comments

Comments
 (0)