log api call durations

This commit is contained in:
Nikita Galaiko 2023-03-20 15:11:47 +01:00
parent 29a546a301
commit 97bbb00142
No known key found for this signature in database
GPG Key ID: EBAB54E845BA519D
2 changed files with 22 additions and 5 deletions

View File

@ -23,8 +23,12 @@ export type DeltasEvent = {
filePath: string; filePath: string;
}; };
export const list = (params: { projectId: string; sessionId: string; paths?: string[] }) => export const list = async (params: { projectId: string; sessionId: string; paths?: string[] }) => {
invoke<Record<string, Delta[]>>('list_deltas', params); const start = performance.now();
const result = await invoke<Record<string, Delta[]>>('list_deltas', params);
log.debug(`list_deltas took ${performance.now() - start}ms`);
return result;
};
export const subscribe = ( export const subscribe = (
params: { projectId: string; sessionId: string }, params: { projectId: string; sessionId: string },

View File

@ -29,10 +29,23 @@ export type Session = {
activity: Activity[]; activity: Activity[];
}; };
export const listFiles = (params: { projectId: string; sessionId: string; paths?: string[] }) => export const listFiles = async (params: {
invoke<Record<string, string>>('list_session_files', params); projectId: string;
sessionId: string;
paths?: string[];
}) => {
const start = performance.now();
const result = await invoke<Record<string, string>>('list_session_files', params);
log.debug(`list_session_files took ${performance.now() - start}ms`);
return result;
};
const list = (params: { projectId: string }) => invoke<Session[]>('list_sessions', params); const list = async (params: { projectId: string }) => {
const start = performance.now();
const result = await invoke<Session[]>('list_sessions', params);
log.debug(`list_sessions took ${performance.now() - start}ms`);
return result;
};
export default async (params: { projectId: string; earliestTimestampMs?: number }) => { export default async (params: { projectId: string; earliestTimestampMs?: number }) => {
const store = writable([] as Session[]); const store = writable([] as Session[]);