Skip to content

Commit

Permalink
fix: more blocking fixes (#899)
Browse files Browse the repository at this point in the history
* fix: more blocking fixes

* fix function call

* linting
  • Loading branch information
firstof9 authored May 31, 2024
1 parent 8a2acc3 commit 1b95b97
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions custom_components/mail_and_packages/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,9 @@ async def image_file_name(
# Insert place holder image
_LOGGER.debug("Copying %s to %s", mail_none, os.path.join(path, image_name))

copyfile(mail_none, os.path.join(path, image_name))
await hass.async_add_executor_job(
copyfile, mail_none, os.path.join(path, image_name)
)

return image_name

Expand Down Expand Up @@ -365,17 +367,19 @@ async def fetch(
nomail,
)
elif sensor == AMAZON_PACKAGES:
count[sensor] = get_items(
account=account,
param=ATTR_COUNT,
fwds=amazon_fwds,
days=amazon_days,
count[sensor] = await hass.async_add_executor_job(
get_items,
account,
ATTR_COUNT,
amazon_fwds,
amazon_days,
)
count[AMAZON_ORDER] = get_items(
account=account,
param=ATTR_ORDER,
fwds=amazon_fwds,
days=amazon_days,
count[AMAZON_ORDER] = await hass.async_add_executor_job(
get_items,
account,
ATTR_ORDER,
amazon_fwds,
amazon_days,
)
elif sensor == AMAZON_HUB:
value = amazon_hub(account, amazon_fwds)
Expand Down

0 comments on commit 1b95b97

Please sign in to comment.