Skip to content

Commit 8b156b7

Browse files
Await copyfile
1 parent bb241ed commit 8b156b7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

custom_components/battery_notes/library_updater.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,12 @@ async def copy_schema(self):
122122
install_schema_path = os.path.join(os.path.dirname(__file__), "schema.json")
123123
storage_schema_path = self.hass.config.path(STORAGE_DIR, "battery_notes", "schema.json")
124124
os.makedirs(os.path.dirname(storage_schema_path), exist_ok=True)
125-
shutil.copyfile(install_schema_path, storage_schema_path)
125+
os.copy_file_range
126+
await self.hass.async_add_executor_job(
127+
shutil.copyfile,
128+
install_schema_path,
129+
storage_schema_path,
130+
)
126131

127132
async def time_to_update_library(self, hours: int) -> bool:
128133
"""Check when last updated and if OK to do a new library update."""

0 commit comments

Comments
 (0)