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
=== modified file 'openlp/plugins/bibles/lib/db.py'
--- openlp/plugins/bibles/lib/db.py 2013-12-21 23:26:36 +0000
+++ openlp/plugins/bibles/lib/db.py 2013-12-28 22:21:49 +0000
@@ -32,9 +32,11 @@
32import os32import os
33import re33import re
34import sqlite334import sqlite3
35import time
3536
36from PyQt4 import QtCore37from PyQt4 import QtCore
37from sqlalchemy import Column, ForeignKey, or_, Table, types, func38from sqlalchemy import Column, ForeignKey, or_, Table, types, func
39from sqlalchemy.exc import OperationalError
38from sqlalchemy.orm import class_mapper, mapper, relation40from sqlalchemy.orm import class_mapper, mapper, relation
39from sqlalchemy.orm.exc import UnmappedClassError41from sqlalchemy.orm.exc import UnmappedClassError
4042
@@ -48,6 +50,7 @@
4850
49RESERVED_CHARACTERS = u'\\.^$*+?{}[]()'51RESERVED_CHARACTERS = u'\\.^$*+?{}[]()'
5052
53
51class BibleMeta(BaseModel):54class BibleMeta(BaseModel):
52 """55 """
53 Bible Meta Data56 Bible Meta Data
@@ -257,7 +260,12 @@
257 text=verse_text260 text=verse_text
258 )261 )
259 self.session.add(verse)262 self.session.add(verse)
260 self.session.commit()263 try:
264 self.session.commit()
265 except OperationalError:
266 # Wait 10ms and try again.
267 time.sleep(0.01)
268 self.session.commit()
261269
262 def create_verse(self, book_id, chapter, verse, text):270 def create_verse(self, book_id, chapter, verse, text):
263 """271 """
@@ -363,7 +371,7 @@
363371
364 ``book``372 ``book``
365 The name of the book, according to the selected language.373 The name of the book, according to the selected language.
366 374
367 ``language_selection``375 ``language_selection``
368 The language selection the user has chosen in the settings376 The language selection the user has chosen in the settings
369 section of the Bible.377 section of the Bible.

Subscribers

People subscribed via source and target branches