Add delays and retry logic for SetOption verification

- Wait 0.5s after sending command before first verification
- Retry verification once with 0.5s delay if first attempt fails
- Increase delay between commands from 0.3s to 0.5s
- Add delay after enabling rules
- Prevents false verification failures by giving device time to process
- Avoids overwhelming device with rapid command sequences
This commit is contained in:
Mike Geppert 2026-01-07 19:52:32 -06:00
parent 73acc41145
commit 794eb4319b

View File

@ -180,10 +180,20 @@ class ConsoleSettingsManager:
self.logger.error(f"{device_name}: Failed to set {param_name} after 3 attempts") self.logger.error(f"{device_name}: Failed to set {param_name} after 3 attempts")
return False return False
# Wait for device to process the command before verifying
time.sleep(0.5)
# Verify the command was applied (if possible) # Verify the command was applied (if possible)
if not self._verify_command(device_ip, device_name, param_name, param_value): verified = self._verify_command(device_ip, device_name, param_name, param_value)
self.logger.warning(f"{device_name}: Verification failed for {param_name}")
# Don't return False here - some commands can't be verified if not verified:
# Wait a bit longer and try verification again
time.sleep(0.5)
verified = self._verify_command(device_ip, device_name, param_name, param_value)
if not verified:
self.logger.warning(f"{device_name}: Verification failed for {param_name}")
# Don't return False here - some commands can't be verified
# Check if this is a rule definition - if so, enable it # Check if this is a rule definition - if so, enable it
if param_name.lower().startswith('rule'): if param_name.lower().startswith('rule'):
@ -203,7 +213,9 @@ class ConsoleSettingsManager:
if not success: if not success:
self.logger.warning(f"{device_name}: Failed to enable rule{rule_number}") self.logger.warning(f"{device_name}: Failed to enable rule{rule_number}")
time.sleep(0.3) # Brief delay between commands time.sleep(0.5) # Wait after enabling rule
time.sleep(0.5) # Delay between commands to avoid overwhelming device
return True return True
def _verify_command(self, device_ip: str, device_name: str, def _verify_command(self, device_ip: str, device_name: str,