diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-01-11 16:22:50 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-01-11 16:22:50 +0100 |
commit | dea32aacde362a5fbd62a88cd32487768b788468 (patch) | |
tree | 3e11525470bb5a2ba0bfba99087f107494f49edf /server | |
parent | bf4ff8fe0be63422c05d42e12f25b454bb95d1a5 (diff) | |
download | PeerTube-dea32aacde362a5fbd62a88cd32487768b788468.tar.gz PeerTube-dea32aacde362a5fbd62a88cd32487768b788468.tar.zst PeerTube-dea32aacde362a5fbd62a88cd32487768b788468.zip |
Server: always check commit result
Diffstat (limited to 'server')
-rw-r--r-- | server/controllers/api/remote/videos.js | 16 | ||||
-rw-r--r-- | server/controllers/api/videos.js | 23 | ||||
-rw-r--r-- | server/initializers/migrator.js | 2 |
3 files changed, 27 insertions, 14 deletions
diff --git a/server/controllers/api/remote/videos.js b/server/controllers/api/remote/videos.js index 6d768eae8..17bdce019 100644 --- a/server/controllers/api/remote/videos.js +++ b/server/controllers/api/remote/videos.js | |||
@@ -171,9 +171,12 @@ function addRemoteVideo (videoToCreateData, fromPod, finalCallback) { | |||
171 | } | 171 | } |
172 | 172 | ||
173 | // Commit transaction | 173 | // Commit transaction |
174 | t.commit() | 174 | t.commit().asCallback(function (err) { |
175 | if (err) return finalCallback(err) | ||
175 | 176 | ||
176 | return finalCallback() | 177 | logger.info('Remote video %s inserted.', videoToCreateData.videoToCreateData.name) |
178 | return finalCallback(null) | ||
179 | }) | ||
177 | }) | 180 | }) |
178 | } | 181 | } |
179 | 182 | ||
@@ -254,10 +257,13 @@ function updateRemoteVideo (videoAttributesToUpdate, fromPod, finalCallback) { | |||
254 | return finalCallback(err) | 257 | return finalCallback(err) |
255 | } | 258 | } |
256 | 259 | ||
257 | // Commit transaction | 260 | // Commit transaction |
258 | t.commit() | 261 | t.commit().asCallback(function (err) { |
262 | if (err) return finalCallback(err) | ||
259 | 263 | ||
260 | return finalCallback() | 264 | logger.info('Remote video %s updated', videoAttributesToUpdate.name) |
265 | return finalCallback(null) | ||
266 | }) | ||
261 | }) | 267 | }) |
262 | } | 268 | } |
263 | 269 | ||
diff --git a/server/controllers/api/videos.js b/server/controllers/api/videos.js index 6573b1210..df068f961 100644 --- a/server/controllers/api/videos.js +++ b/server/controllers/api/videos.js | |||
@@ -231,11 +231,12 @@ function addVideo (req, res, videoFile, callback) { | |||
231 | } | 231 | } |
232 | 232 | ||
233 | // Commit transaction | 233 | // Commit transaction |
234 | t.commit() | 234 | t.commit().asCallback(function (err) { |
235 | if (err) return callback(err) | ||
235 | 236 | ||
236 | logger.info('Video with name %s created.', videoInfos.name) | 237 | logger.info('Video with name %s created.', videoInfos.name) |
237 | 238 | return callback(null) | |
238 | return callback(null) | 239 | }) |
239 | }) | 240 | }) |
240 | } | 241 | } |
241 | 242 | ||
@@ -324,9 +325,12 @@ function updateVideo (req, res, finalCallback) { | |||
324 | } | 325 | } |
325 | 326 | ||
326 | // Commit transaction | 327 | // Commit transaction |
327 | t.commit() | 328 | t.commit().asCallback(function (err) { |
329 | if (err) return finalCallback(err) | ||
328 | 330 | ||
329 | return finalCallback(null) | 331 | logger.info('Video with name %s updated.', videoInfosToUpdate.name) |
332 | return finalCallback(null) | ||
333 | }) | ||
330 | }) | 334 | }) |
331 | } | 335 | } |
332 | 336 | ||
@@ -442,9 +446,12 @@ function reportVideoAbuse (req, res, finalCallback) { | |||
442 | } | 446 | } |
443 | 447 | ||
444 | // Commit transaction | 448 | // Commit transaction |
445 | t.commit() | 449 | t.commit().asCallback(function (err) { |
450 | if (err) return finalCallback(err) | ||
446 | 451 | ||
447 | return finalCallback(null) | 452 | logger.info('Abuse report for video %s created.', videoInstance.name) |
453 | return finalCallback(null) | ||
454 | }) | ||
448 | }) | 455 | }) |
449 | } | 456 | } |
450 | 457 | ||
diff --git a/server/initializers/migrator.js b/server/initializers/migrator.js index eaecb4936..e5288b615 100644 --- a/server/initializers/migrator.js +++ b/server/initializers/migrator.js | |||
@@ -91,7 +91,7 @@ function executeMigration (actualVersion, entity, callback) { | |||
91 | return callback(err) | 91 | return callback(err) |
92 | } | 92 | } |
93 | 93 | ||
94 | t.commit() | 94 | t.commit().asCallback(callback) |
95 | }) | 95 | }) |
96 | }) | 96 | }) |
97 | }) | 97 | }) |