mirror of
https://github.com/aljazceru/landscape-template.git
synced 2026-01-08 00:44:29 +01:00
perf: cache expressApp instance
This commit is contained in:
@@ -48,4 +48,11 @@ const createExpressApp = () => {
|
||||
return app;
|
||||
}
|
||||
|
||||
module.exports = { createExpressApp };
|
||||
let expressApp;
|
||||
|
||||
if (!global.expressApp) {
|
||||
global.expressApp = createExpressApp();
|
||||
}
|
||||
expressApp = global.expressApp;
|
||||
|
||||
module.exports = { createExpressApp: () => expressApp };
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
const session = require("express-session");
|
||||
var Store = require('connect-pg-simple')(session);
|
||||
let sessionsStore;
|
||||
|
||||
if (!global.sessionsStore) {
|
||||
const session = require("express-session");
|
||||
var Store = require('connect-pg-simple')(session);
|
||||
console.log("New Sessions Store");
|
||||
global.sessionsStore = new Store({
|
||||
createTableIfMissing: true,
|
||||
|
||||
@@ -7,7 +7,6 @@ import { useMeQuery } from "src/graphql"
|
||||
import { CONSTS } from "src/utils";
|
||||
import { QRCodeSVG } from 'qrcode.react';
|
||||
import { IoQrCode } from "react-icons/io5";
|
||||
import Button from "src/Components/Button/Button";
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +55,7 @@ export default function LoginPage() {
|
||||
}, [])
|
||||
|
||||
const startPolling = () => {
|
||||
meQuery.startPolling(1500)
|
||||
meQuery.startPolling(3000)
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user