Commit 850271a1 authored by juga's avatar juga
Browse files

Check if file exists before locking it

parent cf9a55a3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -48,9 +48,9 @@ class State:
        self._state = self._read()

    def _read(self):
        with FileLock(self._fname):
        if not os.path.exists(self._fname):
            return {}
        with FileLock(self._fname):
            with open(self._fname, 'rt') as fd:
                return json.load(fd)