Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions src/everything/everything.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,17 @@ export const createServer = () => {

let subscriptions: Set<string> = new Set();
let subsUpdateInterval: NodeJS.Timeout | undefined;
// Set up update interval for subscribed resources
let stdErrUpdateInterval: NodeJS.Timeout | undefined;

// Set up update interval for subscribed resources
subsUpdateInterval = setInterval(() => {
for (const uri of subscriptions) {
server.notification({
method: "notifications/resources/updated",
params: { uri },
});
}
}, 5000);
}, 10000);

let logLevel: LoggingLevel = "debug";
let logsUpdateInterval: NodeJS.Timeout | undefined;
Expand Down Expand Up @@ -152,7 +153,21 @@ export const createServer = () => {
};
if (!isMessageIgnored(message.params.level as LoggingLevel))
server.notification(message);
}, 15000);
}, 20000);


// Set up update interval for stderr messages
stdErrUpdateInterval = setInterval(() => {
const shortTimestamp = new Date().toLocaleTimeString([], {
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
});
server.notification({
method: "notifications/stderr",
params: { content: `${shortTimestamp}: A stderr message` },
});
}, 30000);

// Helper method to request sampling from client
const requestSampling = async (
Expand Down Expand Up @@ -676,6 +691,7 @@ export const createServer = () => {
const cleanup = async () => {
if (subsUpdateInterval) clearInterval(subsUpdateInterval);
if (logsUpdateInterval) clearInterval(logsUpdateInterval);
if (stdErrUpdateInterval) clearInterval(stdErrUpdateInterval);
};

return { server, cleanup };
Expand Down