Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
agkyra
Commits
21a07727
Commit
21a07727
authored
Jun 26, 2015
by
Stavros Sachtouris
Committed by
Giorgos Korfiatis
Oct 19, 2015
Browse files
Retry initializing database when it is locked
parent
edf47a75
Changes
2
Hide whitespace changes
Inline
Side-by-side
agkyra/cli.py
View file @
21a07727
...
...
@@ -306,7 +306,3 @@ class AgkyraCLI(cmd.Cmd):
else
:
sys
.
stderr
.
write
(
'Not running
\n
'
)
sys
.
stderr
.
flush
()
def
do_florist
(
self
,
line
):
"""RUN FLORIST, RUN!"""
sys
.
stderr
.
write
(
'RUN: %s
\n
'
%
STATUS
)
agkyra/protocol.py
View file @
21a07727
...
...
@@ -38,6 +38,7 @@ with open(os.path.join(CURPATH, 'ui_common.json')) as f:
UI_COMMON
=
json
.
load
(
f
)
STATUS
=
UI_COMMON
[
'STATUS'
]
def
retry_on_locked_db
(
method
,
*
args
,
**
kwargs
):
"""If DB is locked, wait and try again"""
wait
=
kwargs
.
get
(
'wait'
,
0.2
)
...
...
@@ -68,7 +69,7 @@ class SessionHelper(object):
LOG
.
debug
(
'Connect to db'
)
self
.
db
=
sqlite3
.
connect
(
self
.
session_db
)
self
.
_init_db_relation
(
)
retry_on_locked_db
(
self
.
_init_db_relation
)
def
_init_db_relation
(
self
):
"""Create the session relation"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment