Skip to content

Conversation

@Pacodastre
Copy link
Contributor

Also fixes the active users bug in the pie chart.

Two things to note here:

  • at least when running pnpm dev, the progress bars for cpu and ram usage don't load properly at first, but work fine after a few seconds.
  • some error appears in the terminal intermittently. It might be related the websocket being disconnected/reconnected, i'm not 100% sure.
ERROR  [unhandledRejection] Failed to catch-up listener: callback does not exist
    at Object.catchupListener (.nuxt/dev/index.mjs:1:381909)
    at Timeout._onTimeout (.nuxt/dev/index.mjs:1:382028)
    at listOnTimeout (node:internal/timers:608:17)
    at process.processTimers (node:internal/timers:543:7)
userId:  8e03afaf-15d5-4eab-9be8-ae59eaa3a352
id:  3395e664-da84-4709-a1d9-0792789862d0
listers:  Map(1) {
  '8e03afaf-15d5-4eab-9be8-ae59eaa3a352' => Map(1) {
    '3340736d-f8f2-4b62-b70a-a56a8970c992' => { callback: [Function (anonymous)], acls: [Array] } } }

Here's a screenshot the update:

Screenshot From 2025-12-05 00-08-55

return;
}

const acls = await aclManager.fetchAllACLs(h3);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this redundant check here for this endpoint. Did you copy it from the task listen endpoint?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied it from the notification wg.get.ts. I can remove it.

@@ -0,0 +1,81 @@
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remember to remove this comment when you're finished the PR

this.listeners.get(userId)?.delete(id);
}

private async catchupListener(userId: string, id: string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this catchupListener function? I don't get what it's trying to do with the setTimeout at the end.

In the original notification system, it's used to send old notifications to newly connected websockets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function was copied from the notification file as well. I just added a recursive call so that it will be triggered periodically. If you have a better way of dealing with this, let me know and i'll adjust the code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think setInterval is the right thing to use

const activeSessions =
(
await prisma.client.groupBy({
await prisma.session.groupBy({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is okay-ish (works for now but isn't how it's supposed to be). The session store supports multiple backends (database, RAM, KV, etc), this implementation will only work if it's using the DB backend.

To do it properly, we'd need to update the session interface. I can do that if you'd like, or you can take a crack at it.

@@ -0,0 +1,7 @@
export const getPercentage = (value: number, total: number) => {
const percentage = ((total - value) * 100) / total;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this backwards? Shouldn't it be (value / total) * 100?

@DecDuck
Copy link
Member

DecDuck commented Dec 5, 2025

Just threw up a review of this PR, got some questions about it.

@DecDuck
Copy link
Member

DecDuck commented Dec 19, 2025

How's this PR going?

@Pacodastre
Copy link
Contributor Author

Pacodastre commented Dec 19, 2025 via email

@DecDuck
Copy link
Member

DecDuck commented Jan 19, 2026

Any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants