fix: disable join commands on session list for performance

This commit is contained in:
Justin Lin committed 2026-10-10 00:12:30 +11:00
1 parent accfbc620c
commit 3d6eaf6b64
2 files changed
+1 -13

No files matched your search

+1 -11
View File
@@ -28,14 +28,6 @@ export async function sessionList(
},
},
{ $unwind: '$user' },
{
$lookup: {
from: 'commands',
localField: '_id',
foreignField: 'session',
as: 'commands',
},
},
pagination.sort('_id'),
pagination.limit(),
])
@@ -49,7 +41,6 @@ export async function sessionList(
status,
createdAt,
finishedAt,
commands,
lastActivityAt,
} = session
return {
@@ -65,8 +56,7 @@ export async function sessionList(
lastActivityAt && createdAt
? formatTime(lastActivityAt.getTime() - createdAt.getTime())
: 'N/A', // Ensure both dates are present
commandCount: commands?.length || 0,
commands,
commandCount: 0,
}
})
}
@@ -17,7 +17,6 @@
<th>Created At</th>
<th>Finished At</th>
<th>Used Time</th>
<th>Command Count</th>
<th>Session</th>
</tr>
{{#each sessions}}
@@ -29,7 +28,6 @@
<td>{{createdAt}}</td>
<td>{{finishedAt}}</td>
<td>{{usedTime}}</td>
<td>{{commandCount}}</td>
<td><a href='/sessions/{{_id}}'>Detail</a></td>
</tr>
{{/each}}