1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 10:19:35 +02:00

Refactor getOrCreateAPVideo

This commit is contained in:
Chocobozzz 2021-06-02 15:47:05 +02:00
parent c56faf0d94
commit 304a84d59c
No known key found for this signature in database
GPG key ID: 583A612D890159BE
19 changed files with 243 additions and 209 deletions

View file

@ -102,6 +102,10 @@ function getFollowsSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]):
}
function isOutdated (model: { createdAt: Date, updatedAt: Date }, refreshInterval: number) {
if (!model.createdAt || !model.updatedAt) {
throw new Error('Miss createdAt & updatedAt attribuets to model')
}
const now = Date.now()
const createdAtTime = model.createdAt.getTime()
const updatedAtTime = model.updatedAt.getTime()