server: Use atomic_write for the device id file.
This commit is contained in:
parent
f56279b29d
commit
5228e50e2e
1 changed files with 2 additions and 1 deletions
|
@ -23,6 +23,7 @@ import ssl
|
||||||
import time
|
import time
|
||||||
import copy
|
import copy
|
||||||
from collections import defaultdict, deque
|
from collections import defaultdict, deque
|
||||||
|
from atomicwrites import atomic_write
|
||||||
from typing import Any, Deque, Dict, Optional, List, NamedTuple, DefaultDict
|
from typing import Any, Deque, Dict, Optional, List, NamedTuple, DefaultDict
|
||||||
|
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
@ -305,7 +306,7 @@ class MatrixServer(object):
|
||||||
file_name = "{}{}".format(self.config.username, ".device_id")
|
file_name = "{}{}".format(self.config.username, ".device_id")
|
||||||
path = os.path.join(self.get_session_path(), file_name)
|
path = os.path.join(self.get_session_path(), file_name)
|
||||||
|
|
||||||
with open(path, "w") as device_file:
|
with atomic_write(path, overwrite=True) as device_file:
|
||||||
device_file.write(self.device_id)
|
device_file.write(self.device_id)
|
||||||
|
|
||||||
def _change_client(self):
|
def _change_client(self):
|
||||||
|
|
Loading…
Add table
Reference in a new issue