File tree 1 file changed +8
-2
lines changed
matter_server/server/helpers
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 10
10
import asyncio
11
11
from datetime import UTC , datetime , timedelta
12
12
import logging
13
- from os import makedirs
13
+ import os
14
14
from pathlib import Path
15
15
import re
16
16
@@ -162,7 +162,13 @@ async def fetch_certificates(
162
162
loop = asyncio .get_running_loop ()
163
163
164
164
if not paa_root_cert_dir .is_dir ():
165
- await loop .run_in_executor (None , makedirs , paa_root_cert_dir )
165
+
166
+ def _make_root_cert_dir (paa_root_cert_dir : Path ) -> None :
167
+ paa_root_cert_dir .mkdir (parents = True )
168
+ # Clear mtime to make sure code retries if first fetch fails.
169
+ os .utime (paa_root_cert_dir , (0 , 0 ))
170
+
171
+ await loop .run_in_executor (None , _make_root_cert_dir , paa_root_cert_dir )
166
172
else :
167
173
stat = await loop .run_in_executor (None , paa_root_cert_dir .stat )
168
174
last_fetch = datetime .fromtimestamp (stat .st_mtime , tz = UTC )
You can’t perform that action at this time.
0 commit comments