]> git.ipfire.org Git - pbs.git/commitdiff
Send each message in one transaction
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 24 Oct 2017 14:17:35 +0000 (15:17 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 24 Oct 2017 14:17:35 +0000 (15:17 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/messages.py

index c80612b9916de1b7707aa50d8d33665a7128cdfb..911a1adfcc9a81e12dfa1379fa8780981962b929 100644 (file)
@@ -41,11 +41,14 @@ class Messages(base.Object):
                while True:
                        messages = self.get_all(limit=10)
 
-                       for message in messages:
-                               self.send_msg(message)
-                       else:
+                       # If no emails are available, we end here
+                       if not messages:
                                break
 
+                       for message in messages:
+                               with self.db.transaction():
+                                       self.send_msg(message)
+
        def send_to_all(self, recipients, subject, body, format=None):
                """
                        Sends an email to all recipients and does the translation.