Fix invalid state change notif of remote live
This commit is contained in:
parent
4662badde7
commit
1e121c9898
3 changed files with 11 additions and 6 deletions
|
@ -86,9 +86,13 @@ describe('Test live socket messages', function () {
|
|||
await waitUntilLivePublishedOnAllServers(servers, liveVideoUUID)
|
||||
await waitJobs(servers)
|
||||
|
||||
// Ensure remote server doesn't send multiple times the state change event to viewers
|
||||
await servers[0].videos.update({ id: liveVideoUUID, attributes: { name: 'my new live name' } })
|
||||
await waitJobs(servers)
|
||||
|
||||
for (const stateChanges of [ localStateChanges, remoteStateChanges ]) {
|
||||
expect(stateChanges).to.have.length.at.least(1)
|
||||
expect(stateChanges[stateChanges.length - 1]).to.equal(VideoState.PUBLISHED)
|
||||
expect(stateChanges).to.have.lengthOf(1)
|
||||
expect(stateChanges[0]).to.equal(VideoState.PUBLISHED)
|
||||
}
|
||||
|
||||
await stopFfmpeg(ffmpegCommand)
|
||||
|
|
|
@ -53,6 +53,7 @@ export class APVideoUpdater extends APVideoAbstractBuilder {
|
|||
|
||||
this.checkChannelUpdateOrThrow(channelActor)
|
||||
|
||||
const oldState = this.video.state
|
||||
const videoUpdated = await this.updateVideo(channelActor.VideoChannel, undefined, overrideTo)
|
||||
|
||||
if (thumbnailModel) await videoUpdated.addAndSaveThumbnail(thumbnailModel)
|
||||
|
@ -95,7 +96,7 @@ export class APVideoUpdater extends APVideoAbstractBuilder {
|
|||
Notifier.Instance.notifyOnNewVideoIfNeeded(videoUpdated)
|
||||
}
|
||||
|
||||
if (videoUpdated.isLive) {
|
||||
if (videoUpdated.isLive && oldState !== videoUpdated.state) {
|
||||
PeerTubeSocket.Instance.sendVideoLiveNewState(videoUpdated)
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ export class UpdateVideosScheduler extends AbstractScheduler {
|
|||
|
||||
private async updateAVideo (schedule: MScheduleVideoUpdate) {
|
||||
let oldPrivacy: VideoPrivacyType
|
||||
let isNewVideo: boolean
|
||||
let isNewVideoForFederation: boolean
|
||||
let published = false
|
||||
|
||||
const video = await sequelizeTypescript.transaction(async t => {
|
||||
|
@ -58,7 +58,7 @@ export class UpdateVideosScheduler extends AbstractScheduler {
|
|||
logger.info('Executing scheduled video update on %s.', video.uuid)
|
||||
|
||||
if (schedule.privacy) {
|
||||
isNewVideo = video.isNewVideoForFederation(schedule.privacy)
|
||||
isNewVideoForFederation = video.isNewVideoForFederation(schedule.privacy)
|
||||
oldPrivacy = video.privacy
|
||||
|
||||
setVideoPrivacy(video, schedule.privacy)
|
||||
|
@ -78,7 +78,7 @@ export class UpdateVideosScheduler extends AbstractScheduler {
|
|||
return { video, published: false }
|
||||
}
|
||||
|
||||
await addVideoJobsAfterUpdate({ video, oldPrivacy, isNewVideo, nameChanged: false })
|
||||
await addVideoJobsAfterUpdate({ video, oldPrivacy, isNewVideoForFederation, nameChanged: false })
|
||||
|
||||
return { video, published }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue