MDL-62709 core_message: fix for silently ignored errors in task
authorDavid M Penner <pennedav@gmail.com>
Wed, 13 Jun 2018 18:24:28 +0000 (14:24 -0400)
committerMark Nelson <markn@moodle.com>
Thu, 14 Jun 2018 04:20:42 +0000 (12:20 +0800)
message/classes/task/migrate_message_data.php

index e81dee0..a2a76d1 100644 (file)
@@ -90,10 +90,10 @@ class migrate_message_data extends \core\task\adhoc_task {
                             $this->migrate_data($userid, $otheruserid);
                             $transaction->allow_commit();
                         } catch (\Throwable $e) {
-                            $updatepreference = false;
+                            throw $e;
+                        } finally {
+                            $lock->release();
                         }
-
-                        $lock->release();
                     } else {
                         // Couldn't get a lock, move on to next user but make sure we don't update user preference so
                         // we still try again.