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

Proposed by Raoul Snyman
Status: Merged
Merged at revision: 2184
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
Andreas Preikschat (community) Approve
Phill Pending
Tim Bentley Pending
Review via email: mp+200137@code.launchpad.net

This proposal supersedes a proposal from 2013-12-21.

Description of the change

Attempt to fix bug #1154467 by waiting 10ms and retrying the commit

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

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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

review: Approve
Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) :
review: Approve

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:21:49 +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