Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
juga
sbws
Commits
850271a1
Commit
850271a1
authored
Aug 29, 2018
by
juga
Browse files
Check if file exists before locking it
parent
cf9a55a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
sbws/util/state.py
View file @
850271a1
...
...
@@ -48,9 +48,9 @@ class State:
self
.
_state
=
self
.
_read
()
def
_read
(
self
):
if
not
os
.
path
.
exists
(
self
.
_fname
):
return
{}
with
FileLock
(
self
.
_fname
):
if
not
os
.
path
.
exists
(
self
.
_fname
):
return
{}
with
open
(
self
.
_fname
,
'rt'
)
as
fd
:
return
json
.
load
(
fd
)
...
...
Write
Preview
Supports
Markdown
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