GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit fe827ac1 authored by juga  's avatar juga 💬

fix: state: Read file before setting key

Otherwise, if other instance of state set a key, it's lost by the
current instance.

Bugfix v0.7.0.
parent 89efc2b6
......@@ -97,6 +97,9 @@ class State:
raise TypeError(
'May only store value with type in %s, not %s' %
(State._ALLOWED_TYPES, type(value)))
# NOTE: important, read the file before setting the key,
# otherwise if other instances are creating other keys, they're lost.
self._state = self._read()
self._state.__setitem__(key, value)
self._write()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment