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

Update main.js - Login Wait Loop #917

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Flyor
Copy link

@Flyor Flyor commented Aug 18, 2024

Nach einem Ausfall meiner Internetleitung, versucht der Adapter dauerhaft eine Verbindung mit einem der Server aufzubauen, was dazu führte, dass mein kompletter iobroker von meinem PiHole "offline" gesetzt wurde. Die Anfragen von dem Worx Adapter beliefen sich auf über 1000 Anfragen innerhalb von weniger als 1 Minute. Ich habe eine Zeitschleife eingebaut, welche nach mehreren gescheiterten Abfragen eine Minute wartet, bevor es neue Anfragen sendet.

After an outage of my internet connection, the adapter continuously tried to establish a connection with one of the servers, which caused my entire ioBroker to be marked as "offline" by my PiHole. The requests from the Worx adapter amounted to over 1,000 requests within less than a minute. I have now implemented a delay loop that waits for one minute after several failed requests before sending new ones.

Nach einem Ausfall meiner Internetleitung, versucht der Adapter dauerhaft eine Verbindung mit einem der Server aufzubauen, was dazu führte, dass mein kompletter iobroker von meinem PiHole "offline" gesetzt wurde. Die Anfragen von dem Worx Adapter beliefen sich auf über 1000 Anfragen innerhalb von weniger als 1 Minute. Ich habe eine Zeitschleife eingebaut, welche nach mehreren gescheiterten Abfragen eine Minute wartet, bevor es neue Anfragen sendet. 

After an outage of my internet connection, the adapter continuously tried to establish a connection with one of the servers, which caused my entire ioBroker to be marked as "offline" by my PiHole. The requests from the Worx adapter amounted to over 1,000 requests within less than a minute. I have now implemented a delay loop that waits for one minute after several failed requests before sending new ones.
@mcm1957
Copy link
Member

mcm1957 commented Aug 19, 2024

Thanks for providing this improvement.

Code should use adapter.delay (or this.delay) instead of own construct. Otherwise retryDelay timer must be captured and canceled during onUnload.

used this.delay instead of own delay
@Flyor
Copy link
Author

Flyor commented Aug 19, 2024

Thanks for providing this improvement.

Code should use adapter.delay (or this.delay) instead of own construct. Otherwise retryDelay timer must be captured and canceled during onUnload.

Done. Updated with this.delay

@Flyor
Copy link
Author

Flyor commented Aug 19, 2024

I saw that the automatic tests failed, unfortunately I am not able to locate the error or correct it.

I think I have explained the function, if you could implement it yourself using your own resources or fix my principle, I would be very happy if the number of requests without an internet connection would no longer skyrocket in the future.

@mcm1957
Copy link
Member

mcm1957 commented Aug 19, 2024

Take a look at line 236. Looks like the closing brace closes the complet routine here what would be incorrect. Mayby you added a closing brace too much.

But I did not check with an ie for now onl at webview and this might be incorrect although GitHub shows the matching pairs.

@mcm1957
Copy link
Member

mcm1957 commented Aug 19, 2024

And please conform that you used th code provided at the PR at your system / test system. :-)

@Lucky-ESA
Copy link
Collaborator

@Flyor Habe mal ein Timeout bei Axios hinzugefügt was aber keine Auswirkung haben wird. Die login Funktion wird nur 1 x beim start vom Adapter aufgerufen und kann somit nicht 1000 auslösen. Hier hast du eher woanders ein Problem aber nicht mit dem Adapter.

Gruß//Lucky

@Flyor
Copy link
Author

Flyor commented Aug 23, 2024

@Flyor Habe mal ein Timeout bei Axios hinzugefügt was aber keine Auswirkung haben wird. Die login Funktion wird nur 1 x beim start vom Adapter aufgerufen und kann somit nicht 1000 auslösen. Hier hast du eher woanders ein Problem aber nicht mit dem Adapter.

Gruß//Lucky

Naja - ich habe innerhalb 1h (in der Stunde, war das INet weg) über 1800 DNS Aufrufe an landxcape server. Gestartet hat das ganze auf die Minute, als das Internet ausgefallen ist. Hier ein Auszug aus dem pihole log (man beachte die Sekunden):

image

@Lucky-ESA
Copy link
Collaborator

Das ist die MQTT Verbindung und nicht die Cloud. Der Adapter kann eigentlich damit umgehen dann hat wohl das aws package ein Problem. Du kannst ja mal den Adapter auf debug stellen und danach die Internetverbindung trennen. Wäre interessant ob die events von aws Daten liefern.

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

3 participants