Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use less move cron.CronJob from an instance variable to a package level singleton, to reduce the number of API calls #29

Merged
merged 1 commit into from
May 1, 2023

Conversation

mash
Copy link
Contributor

@mash mash commented Apr 22, 2023

Hi, thank you for the awesome project.

I noticed when I have multiple accessories, this plugin makes API calls for each accessory resulting in 429 Too many requests error response from the API server, depending on the number of accessories and other API calls.

The response for /1/appliances and /1/devices include all the appliances and devices, so the API call can be once per accessory.

In this pull request I have moved the cron.CronJob from an instance variable of NatureRemoAircon to a package level variable so that multiple instances of NatureRemoAircon can use the single updater.

singleton, to reduce the number of API calls
@kmaehashi
Copy link
Owner

Hi @mash, thanks for the contribtion! Looks good to me :shipit:

@kmaehashi kmaehashi merged commit 1907967 into kmaehashi:master May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants