Skip to content

Commit

Permalink
fix: get last logs
Browse files Browse the repository at this point in the history
  • Loading branch information
oxdev03 committed Apr 21, 2024
1 parent 72ec99b commit 4e931b3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/dashboard/server/routers/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const processRouter = router({
const process = await processModel.findById(input.processId);
checkPermission(process, ctx.user, [PERMISSIONS.LOGS]);
const limit = input.limit || 100;
return process?.logs?.slice(process.logs.length - limit, process.logs.length);
return process?.logs?.slice(-limit);
}),
getStat: protectedProcedure.input(z.object({ processId: z.string() })).query(async ({ ctx, input }) => {
const process = await processModel.findById(input.processId);
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/server/routers/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const serverRouter = router({

filteredLogs.sort((a, b) => new Date(a?.createdAt || 0).getTime() - new Date(b?.createdAt || 0).getTime());

return filteredLogs.slice(0, limit);
return filteredLogs.slice(-limit);
}),

getStats: protectedProcedure
Expand Down

0 comments on commit 4e931b3

Please sign in to comment.