aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-03-19 14:13:53 +0100
committerChocobozzz <me@florianbigard.com>2019-03-19 14:13:53 +0100
commit9f79ade627f0044606a9fbbe16ca0154661d12b9 (patch)
treeccfc1876da591bc52cbb4b8ccddedbeae7876679 /server/models/video/video.ts
parent0e0c745b62b2f18e228328e8c4f95b17e54f7a5e (diff)
downloadPeerTube-9f79ade627f0044606a9fbbe16ca0154661d12b9.tar.gz
PeerTube-9f79ade627f0044606a9fbbe16ca0154661d12b9.tar.zst
PeerTube-9f79ade627f0044606a9fbbe16ca0154661d12b9.zip
Refresh playlists
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r--server/models/video/video.ts11
1 files changed, 3 insertions, 8 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 946be6095..fb037c21a 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -77,7 +77,7 @@ import {
77 buildTrigramSearchIndex, 77 buildTrigramSearchIndex,
78 buildWhereIdOrUUID, 78 buildWhereIdOrUUID,
79 createSimilarityAttribute, 79 createSimilarityAttribute,
80 getVideoSort, 80 getVideoSort, isOutdated,
81 throwIfNotValid 81 throwIfNotValid
82} from '../utils' 82} from '../utils'
83import { TagModel } from './tag' 83import { TagModel } from './tag'
@@ -1547,7 +1547,7 @@ export class VideoModel extends Model<VideoModel> {
1547 attributes: query.attributes, 1547 attributes: query.attributes,
1548 order: [ // Keep original order 1548 order: [ // Keep original order
1549 Sequelize.literal( 1549 Sequelize.literal(
1550 ids.map(id => `"VideoModel".id = ${id} DESC`).join(', ') 1550 ids.map(id => `"VideoModel".id = ${id}`).join(', ')
1551 ) 1551 )
1552 ] 1552 ]
1553 } 1553 }
@@ -1767,12 +1767,7 @@ export class VideoModel extends Model<VideoModel> {
1767 isOutdated () { 1767 isOutdated () {
1768 if (this.isOwned()) return false 1768 if (this.isOwned()) return false
1769 1769
1770 const now = Date.now() 1770 return isOutdated(this, ACTIVITY_PUB.VIDEO_REFRESH_INTERVAL)
1771 const createdAtTime = this.createdAt.getTime()
1772 const updatedAtTime = this.updatedAt.getTime()
1773
1774 return (now - createdAtTime) > ACTIVITY_PUB.VIDEO_REFRESH_INTERVAL &&
1775 (now - updatedAtTime) > ACTIVITY_PUB.VIDEO_REFRESH_INTERVAL
1776 } 1771 }
1777 1772
1778 setAsRefreshed () { 1773 setAsRefreshed () {