// If the transaction is retried, sequelize will think the object has not changed
// So we need to restore the previous fields
- resetSequelizeInstance(videoChannelInstance)
+ await resetSequelizeInstance(videoChannelInstance)
throw err
}
// If the transaction is retried, sequelize will think the object has not changed
// So we need to restore the previous fields
- resetSequelizeInstance(videoPlaylistInstance)
+ await resetSequelizeInstance(videoPlaylistInstance)
throw err
}
} catch (err) {
// If the transaction is retried, sequelize will think the object has not changed
// So we need to restore the previous fields
- resetSequelizeInstance(videoFromReq)
+ await resetSequelizeInstance(videoFromReq)
throw err
} finally {
// ---------------------------------------------------------------------------
-function updateInstanceWithAnother <M, T extends U, U extends Model<M>> (instanceToUpdate: T, baseInstance: U) {
- const obj = baseInstance.toJSON()
-
- for (const key of Object.keys(obj)) {
- instanceToUpdate[key] = obj[key]
- }
-}
-
function resetSequelizeInstance <T> (instance: Model<T>) {
- instance.set(instance.previous())
+ return instance.reload()
}
function filterNonExistingModels <T extends { hasSameUniqueKeysThan (other: T): boolean }> (
resetSequelizeInstance,
retryTransactionWrapper,
transactionRetryer,
- updateInstanceWithAnother,
afterCommitIfTransaction,
filterNonExistingModels,
deleteAllModels,
logger.info('Remote account %s updated', this.actorObject.url)
} catch (err) {
if (this.actor !== undefined) {
- resetSequelizeInstance(this.actor)
+ await resetSequelizeInstance(this.actor)
}
if (this.accountOrChannel !== undefined) {
- resetSequelizeInstance(this.accountOrChannel)
+ await resetSequelizeInstance(this.accountOrChannel)
}
// This is just a debug because we will retry the insert
return videoUpdated
} catch (err) {
- this.catchUpdateError(err)
+ await this.catchUpdateError(err)
}
}
videoUpdated.VideoLive = null
}
- private catchUpdateError (err: Error) {
+ private async catchUpdateError (err: Error) {
if (this.video !== undefined) {
- resetSequelizeInstance(this.video)
+ await resetSequelizeInstance(this.video)
}
// This is just a debug because we will retry the insert
import { expect } from 'chai'
import { wait } from '@shared/core-utils'
-import { HttpStatusCode, LiveVideoCreate, VideoPrivacy } from '@shared/models'
+import { LiveVideoCreate, VideoPrivacy } from '@shared/models'
import {
cleanupTests,
createSingleServer,
- makeRawRequest,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel,
try {
await server.live.getSegmentFile({ videoUUID: liveId, segment: 0, playlistNumber: 0 })
- await makeRawRequest({ url: video.streamingPlaylists[0].playlistUrl, expectedStatus: HttpStatusCode.OK_200 })
- await makeRawRequest({ url: video.streamingPlaylists[0].segmentsSha256Url, expectedStatus: HttpStatusCode.OK_200 })
+ await server.streamingPlaylists.get({ url: video.streamingPlaylists[0].playlistUrl })
+ await server.streamingPlaylists.getSegmentSha256({ url: video.streamingPlaylists[0].segmentsSha256Url })
} catch (err) {
// FIXME: try to debug error in CI "Unexpected end of JSON input"
console.error(err)
})
it('Should upload 6 videos', async function () {
- this.timeout(25000)
+ this.timeout(50000)
const videos = new Set([
'video_short.mp4', 'video_short.ogv', 'video_short.webm',