aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/utils.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-06-02 15:47:05 +0200
committerChocobozzz <me@florianbigard.com>2021-06-02 16:57:53 +0200
commit304a84d59c3a800b7f7aef48cf55f307534c0926 (patch)
treee099aefd76aa8ee5aacef7ddfc59d79111fe474b /server/models/utils.ts
parentc56faf0d9453490737f283b29a203bb1ca632b95 (diff)
downloadPeerTube-304a84d59c3a800b7f7aef48cf55f307534c0926.tar.gz
PeerTube-304a84d59c3a800b7f7aef48cf55f307534c0926.tar.zst
PeerTube-304a84d59c3a800b7f7aef48cf55f307534c0926.zip
Refactor getOrCreateAPVideo
Diffstat (limited to 'server/models/utils.ts')
-rw-r--r--server/models/utils.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/server/models/utils.ts b/server/models/utils.ts
index e27625bc8..83b2b8f03 100644
--- a/server/models/utils.ts
+++ b/server/models/utils.ts
@@ -102,6 +102,10 @@ function getFollowsSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]):
102} 102}
103 103
104function isOutdated (model: { createdAt: Date, updatedAt: Date }, refreshInterval: number) { 104function isOutdated (model: { createdAt: Date, updatedAt: Date }, refreshInterval: number) {
105 if (!model.createdAt || !model.updatedAt) {
106 throw new Error('Miss createdAt & updatedAt attribuets to model')
107 }
108
105 const now = Date.now() 109 const now = Date.now()
106 const createdAtTime = model.createdAt.getTime() 110 const createdAtTime = model.createdAt.getTime()
107 const updatedAtTime = model.updatedAt.getTime() 111 const updatedAtTime = model.updatedAt.getTime()