diff options
author | Chocobozzz <me@florianbigard.com> | 2018-11-15 16:18:12 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-11-15 16:38:37 +0100 |
commit | 030177d246834fdba89be9bbaeac497589b47102 (patch) | |
tree | a0c5b2e59aeb01322cff9042ceb31d49aadda908 /server/controllers/api | |
parent | 650e3d5ce380026cc79bcd271915cf7e6f51c24c (diff) | |
download | PeerTube-030177d246834fdba89be9bbaeac497589b47102.tar.gz PeerTube-030177d246834fdba89be9bbaeac497589b47102.tar.zst PeerTube-030177d246834fdba89be9bbaeac497589b47102.zip |
Don't forward view, send updates instead
To avoid inconsistencies in the federation, now the origin server will
tell other instances what is the correct number of views
Diffstat (limited to 'server/controllers/api')
-rw-r--r-- | server/controllers/api/videos/index.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 664154406..e654bdd09 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -405,7 +405,11 @@ async function viewVideo (req: express.Request, res: express.Response) { | |||
405 | 405 | ||
406 | const serverActor = await getServerActor() | 406 | const serverActor = await getServerActor() |
407 | 407 | ||
408 | await sendCreateView(serverActor, videoInstance, undefined) | 408 | // Send the event to the origin server |
409 | // If we own the video, we'll send an update event when we'll process the views (in our job queue) | ||
410 | if (videoInstance.isOwned() === false) { | ||
411 | await sendCreateView(serverActor, videoInstance, undefined) | ||
412 | } | ||
409 | 413 | ||
410 | return res.status(204).end() | 414 | return res.status(204).end() |
411 | } | 415 | } |