Merge lp:~raoul-snyman/openlp/bug-1154467-2.0 into lp:openlp/2.0

Proposed by Raoul Snyman
Status: Superseded
Proposed branch: lp:~raoul-snyman/openlp/bug-1154467-2.0
Merge into: lp:openlp/2.0
Diff against target: 46 lines (+10/-2)
1 file modified
openlp/plugins/bibles/lib/db.py (+10/-2)
To merge this branch: bzr merge lp:~raoul-snyman/openlp/bug-1154467-2.0
Reviewer Review Type Date Requested Status
Phill Approve
Andreas Preikschat (community) Needs Information
Tim Bentley Approve
Review via email: mp+199904@code.launchpad.net

This proposal has been superseded by a proposal from 2013-12-28.

Description of the change

Attempt to fix bug #1154467 by retrying the commit if it fails

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) :
review: Approve
Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) wrote :

Will that help when we try twice in a row? Shouldn't we wait some ms? Sure we must not add this to other places where the few ms will sum up to many seconds.....

review: Needs Information
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

I haven't been able to reproduce it, so I wasn't able to see if I actually fixed it. I figured we could at least get this out there and see if it improves the situation.

Revision history for this message
Phill (phill-ridout) wrote :

I cannot reproduce this issue either. But hopefully this will reduce / solve this issue

review: Approve
2182. By Raoul Snyman

Add a 10ms wait before trying again.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/plugins/bibles/lib/db.py'
2--- openlp/plugins/bibles/lib/db.py 2013-12-21 23:26:36 +0000
3+++ openlp/plugins/bibles/lib/db.py 2013-12-28 22:20:43 +0000
4@@ -32,9 +32,11 @@
5 import os
6 import re
7 import sqlite3
8+import time
9
10 from PyQt4 import QtCore
11 from sqlalchemy import Column, ForeignKey, or_, Table, types, func
12+from sqlalchemy.exc import OperationalError
13 from sqlalchemy.orm import class_mapper, mapper, relation
14 from sqlalchemy.orm.exc import UnmappedClassError
15
16@@ -48,6 +50,7 @@
17
18 RESERVED_CHARACTERS = u'\\.^$*+?{}[]()'
19
20+
21 class BibleMeta(BaseModel):
22 """
23 Bible Meta Data
24@@ -257,7 +260,12 @@
25 text=verse_text
26 )
27 self.session.add(verse)
28- self.session.commit()
29+ try:
30+ self.session.commit()
31+ except OperationalError:
32+ # Wait 10ms and try again.
33+ time.sleep(0.01)
34+ self.session.commit()
35
36 def create_verse(self, book_id, chapter, verse, text):
37 """
38@@ -363,7 +371,7 @@
39
40 ``book``
41 The name of the book, according to the selected language.
42-
43+
44 ``language_selection``
45 The language selection the user has chosen in the settings
46 section of the Bible.

Subscribers

People subscribed via source and target branches