mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 06:37:18 +01:00
update websitesession, add session duration
This commit is contained in:
parent
3646039e54
commit
136dd6794e
6 changed files with 25 additions and 8 deletions
|
|
@ -18,17 +18,17 @@ export async function fetchWebsite(websiteId: string): Promise<Website> {
|
|||
return website;
|
||||
}
|
||||
|
||||
export async function fetchSession(sessionId: string): Promise<Session> {
|
||||
export async function fetchSession(websiteId: string, sessionId: string): Promise<Session> {
|
||||
let session = null;
|
||||
|
||||
if (redis.enabled) {
|
||||
session = await redis.client.fetch(
|
||||
`session:${sessionId}`,
|
||||
() => getWebsiteSession(sessionId),
|
||||
() => getWebsiteSession(websiteId, sessionId),
|
||||
86400,
|
||||
);
|
||||
} else {
|
||||
session = await getWebsiteSession(sessionId);
|
||||
session = await getWebsiteSession(websiteId, sessionId);
|
||||
}
|
||||
|
||||
if (!session) {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ export async function getSession(req: NextApiRequestCollect): Promise<SessionDat
|
|||
}
|
||||
|
||||
// Find session
|
||||
let session = await fetchSession(sessionId);
|
||||
let session = await fetchSession(websiteId, sessionId);
|
||||
|
||||
// Create a session if not found
|
||||
if (!session) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue