chaozmc / ioBroker.oekofen-json

Connect ioBroker to OekoFEN Pellematic via JSON
MIT License
4 stars 5 forks source link

Retry Mechanism - allow users to configure max number #38

Closed benbonn closed 2 weeks ago

benbonn commented 1 month ago

A retry mechanism is already in place to handle multiple failed connection attempts. You may want to allow users to configure the maximum number of retries before the adapter disables itself.

The retry mechanism in the code primarily revolves around the failedConnectCounter variable. This counter tracks how many consecutive times a connection attempt to the OekoFEN system has failed. If the number of failed attempts exceeds a set threshold (in this case, 10 attempts), the adapter disables itself.

Bascially update:

"native": {
  "oekofenIp": "1.2.3.4",
  "oekofenPort": "8080",
  "oekofenPassword": "",
  "myRequestInterval": "30",
  "maxRetries": 10  // New configuration for retry limit
}

and

// Check if counter gets too high, if yes, disable the adapter.
if (failedConnectCounter > this.config.maxRetries) {  // Use the configurable maxRetries value
    this.log.error(`[updateData_axios.get.catch] failed to get data ${this.config.maxRetries} times in a row. Disabling adapter. Please check your heater.`);
    this.disable();
}

By adding this configuration option, users can customize how resilient the adapter is in terms of retrying failed connection attempts before it disables itself.

stale[bot] commented 3 weeks ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 2 weeks ago

This issue has beed automatically closed due to inactivity.