diff options
author | Chocobozzz <me@florianbigard.com> | 2023-03-31 13:28:41 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-03-31 13:28:41 +0200 |
commit | bb7e5605d15a2e58791b08101a77fe3437c111a5 (patch) | |
tree | e9a075dfcca0f1b07927be9a4c5cb8b9b8c6b200 | |
parent | 05a60d85997c108d39bcfb14f1ffd4c74f8b1e93 (diff) | |
download | PeerTube-bb7e5605d15a2e58791b08101a77fe3437c111a5.tar.gz PeerTube-bb7e5605d15a2e58791b08101a77fe3437c111a5.tar.zst PeerTube-bb7e5605d15a2e58791b08101a77fe3437c111a5.zip |
Use hook inside the transaction
To prevent serialization issue
-rw-r--r-- | server/models/video/video-live.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/server/models/video/video-live.ts b/server/models/video/video-live.ts index 290e1dda7..1acf9cbf3 100644 --- a/server/models/video/video-live.ts +++ b/server/models/video/video-live.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { Transaction } from 'sequelize' | ||
1 | import { | 2 | import { |
2 | BeforeDestroy, | ||
3 | AllowNull, | 3 | AllowNull, |
4 | BeforeDestroy, | ||
4 | BelongsTo, | 5 | BelongsTo, |
5 | Column, | 6 | Column, |
6 | CreatedAt, | 7 | CreatedAt, |
@@ -100,11 +101,12 @@ export class VideoLiveModel extends Model<Partial<AttributesOnly<VideoLiveModel> | |||
100 | ReplaySetting: VideoLiveReplaySettingModel | 101 | ReplaySetting: VideoLiveReplaySettingModel |
101 | 102 | ||
102 | @BeforeDestroy | 103 | @BeforeDestroy |
103 | static deleteReplaySetting (instance: VideoLiveModel) { | 104 | static deleteReplaySetting (instance: VideoLiveModel, options: { transaction: Transaction }) { |
104 | return VideoLiveReplaySettingModel.destroy({ | 105 | return VideoLiveReplaySettingModel.destroy({ |
105 | where: { | 106 | where: { |
106 | id: instance.replaySettingId | 107 | id: instance.replaySettingId |
107 | } | 108 | }, |
109 | transaction: options.transaction | ||
108 | }) | 110 | }) |
109 | } | 111 | } |
110 | 112 | ||