comment radis

This commit is contained in:
Kittapath 2024-07-24 10:07:00 +07:00
parent 8546044fdc
commit 53e6d66788

View file

@ -28,12 +28,12 @@ export class PermissionController extends Controller {
host: REDIS_HOST, host: REDIS_HOST,
port: REDIS_PORT, port: REDIS_PORT,
}); });
const formattedData = null; // const formattedData = null;
// await Promise.all([ // await Promise.all([
return redisClient.get(request.user.sub, async (err: any, reply: any) => { // return redisClient.get(request.user.sub, async (err: any, reply: any) => {
if (reply != null) { // if (reply != null) {
return new HttpSuccess(JSON.parse(reply)); // return new HttpSuccess(JSON.parse(reply));
} else { // } else {
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
select: ["id"], select: ["id"],
where: { keycloak: request.user.sub }, where: { keycloak: request.user.sub },
@ -79,8 +79,8 @@ export class PermissionController extends Controller {
}; };
redisClient.setex(request.user.sub, 20, JSON.stringify(formattedData)); redisClient.setex(request.user.sub, 20, JSON.stringify(formattedData));
return new HttpSuccess(formattedData); return new HttpSuccess(formattedData);
} // }
}); // });
// ]); // ]);
} }
} }