mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2026-05-26 12:32:25 +00:00
11x speed up of subscription page generation
My 30 subscriptions now take 25 ms to generate, instead of around 280. Around 120 ms were saved by creating a database index. Around 120 ms were saved by pre-compiling the pug template for video description timestamps. The other changes in this commit produced slight improvements.
This commit is contained in:
parent
0aa0505009
commit
55065e2a9e
4 changed files with 15 additions and 9 deletions
|
|
@ -14,7 +14,10 @@ function getToken(req, responseHeaders) {
|
|||
return null
|
||||
}
|
||||
}
|
||||
db.prepare("REPLACE INTO SeenTokens (token, seen) VALUES (?, ?)").run([token, Date.now()])
|
||||
db.prepare(
|
||||
"INSERT INTO SeenTokens (token, seen) VALUES (?, ?)"
|
||||
+ " ON CONFLICT (token) DO UPDATE SET seen = excluded.seen"
|
||||
).run([token, Date.now()])
|
||||
return token
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue