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

Commands dropped / bridge overloaded (Err=429) / Connexion issues #409

Merged
merged 4 commits into from
Nov 5, 2022

Conversation

FredBlo
Copy link
Contributor

@FredBlo FredBlo commented Oct 30, 2022

Context : HUEMagic becomes more often unusable

Based on what I read, it seems HUE has became more and more strict in what it accepts in terms of external API call rates.
Where the bridge easily accepted many calls per second before, it now rejects them more frequently.
Official HUE dev documentation now mentions a maximum of 4 calls per second (but even more strict for calls to groups which are limited to 1 call / second...)
HUEMagic already handled a retry but :

  • it only managed it for error code '503'... but now the bridge responds -most of the time- with '429' in case of overload
  • retry was performed 3 times (after 2s, then 4s, then 8s)
    These caused many issues with commands being delayed to completely lost (not executed).
  • The bridge connection was also often 'reset', with an error on console Error requesting info from the bridge. Reconnect in some secs. undefined. This was caused when HUEMagic polled the bridge to ensure connection was still OK at a moment when the bridge was overloaded (err=429)

Because of this, most of us were not able to enjoy HUEMagic nodes :-(

What did I change ?

  • Error '429' is now correctly taken into account (as was 503 before)
  • All calls will be retried up to 5 times
  • Retry delay will extended by 750ms each time (i.e. 0,75s, 1,5s, ... 3,75)
  • HUEMagic will no longer reset connection when it responds as being overloaded
  • (In case of connection error, the full returned content (page) is send to console for easier debug)
    I have now been running this config for a few weeks and I do not have any connection / drops anymore.

Additional info : merge of other

This pull request also merged #390 from @traverseda and #381 from @Travelbacon, which corrected -very successfully- bugs #375, #374, #377 and #378.
Since then other group issues were reported which should also be solved since I think these are actually the same...
(such as #400)

What you need to do / change ?

I strongly recommend to configure your HUEMagic bridge node using a single 'worker'. Setting more than 1 will always -logically- worsen the overload effect on the bridge.
If you want to use it from now (not waiting for Foddy to merge & publish it), this is possible by installing it manually using command npm install git+https://github.com/fredblo/node-red-contrib-huemagic.git

Travelbacon and others added 4 commits June 26, 2022 19:17
Edit check for undefined for the "private groups."
Fixed bug that on off status in a group is not accepted.
Merged from Travlbacon (solves TypeError: Cannot read property 'owner' of undefined)
* Debug 429
* Review error message to console
* Added debug to connection to bridge errors
* Fine-tuned Error=429 & retries (bridge overloaded)
* Finalize Error=429 & retries (bridge overloaded) & clean debug content
* Grouped light proper correction
* Finalize Error=429 & retries timing optimized (bridge overloaded)
@Travelbacon
Copy link
Contributor

Thank you so much for doing this!

@arw-thomasm
Copy link

Thank you for your work! I tested it and it works like charme! @Foddy can you please merge this PR soon?

@dongennl
Copy link
Contributor

dongennl commented Nov 5, 2022

@Foddy this is really necessary ,please can you consider giving @FredBlo merging rights since he contributes a lot lately. It would help everybody

mauricedominic added a commit to mauricedominic/node-red-contrib-huemagic that referenced this pull request Nov 5, 2022
@Foddy Foddy merged commit f72d311 into Foddy:master Nov 5, 2022
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.

None yet

5 participants