Back

Auth request taking over 400ms

  • 0
  • Cloud
Isak
8 Jul, 2024, 16:30

This code is taking 400+ms to run, why so long?

TypeScript
console.time()

const { account } = createSessionClient(event);
let appwriteUser: any;
try {
    appwriteUser = await account.get();
} catch (error) {
    throw redirect(303, "/login");
}

let domainId = Number(appwriteUser.prefs?.domain) || 0;

console.timeEnd()
TL;DR
Code is taking over 400ms to run due to the API request. Optimize the code to reduce the time by using asynchronous operations to enhance performance.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more