mirror of
https://github.com/umami-software/umami.git
synced 2026-02-20 12:35:38 +01:00
add cache for website id
This commit is contained in:
parent
f8ac987bfc
commit
2f6e7786c6
3 changed files with 38 additions and 4 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { getWebsiteByUuid, getSessionByUuid, createSession } from 'lib/queries';
|
||||
import { getWebsiteIDByUuidCached, getSessionByUuid, createSession } from 'lib/queries';
|
||||
import { getClientInfo } from 'lib/request';
|
||||
import { uuid, isValidUuid, parseToken } from 'lib/crypto';
|
||||
|
||||
|
|
@ -25,13 +25,12 @@ export async function getSession(req) {
|
|||
|
||||
const { userAgent, browser, os, ip, country, device } = await getClientInfo(req, payload);
|
||||
|
||||
const website = await getWebsiteByUuid(website_uuid);
|
||||
const website_id = await getWebsiteIDByUuidCached(website_uuid);
|
||||
|
||||
if (!website) {
|
||||
if (!website_id) {
|
||||
throw new Error(`Website not found: ${website_uuid}`);
|
||||
}
|
||||
|
||||
const { website_id } = website;
|
||||
const session_uuid = uuid(website_id, hostname, ip, userAgent, os);
|
||||
|
||||
let session = await getSessionByUuid(session_uuid);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue