fix: naikkan retry hapus address-list ke 100x, delay 5s
This commit is contained in:
@@ -80,14 +80,14 @@ def deploy_via_rest_api(router, rsc_filepath="routing-lokal.rsc"):
|
||||
print(f"Menghapus address-list '{list_name}' lama di router...")
|
||||
del_payload = {"script": f"/ip/firewall/address-list/remove [find list=\"{list_name}\"]"}
|
||||
|
||||
for attempt in range(10):
|
||||
for attempt in range(100):
|
||||
try:
|
||||
session.post(f"{api_url}/execute", json=del_payload, timeout=60)
|
||||
except Exception as e:
|
||||
print(f" Warning execute remove: {e}")
|
||||
|
||||
import time
|
||||
time.sleep(3)
|
||||
time.sleep(5)
|
||||
|
||||
# Verifikasi: cek apakah sudah benar-benar kosong
|
||||
try:
|
||||
@@ -101,12 +101,12 @@ def deploy_via_rest_api(router, rsc_filepath="routing-lokal.rsc"):
|
||||
print(f" Address-list '{list_name}' bersih (percobaan {attempt + 1})")
|
||||
break
|
||||
elif remaining > 0:
|
||||
print(f" Sisa {remaining} entry, menghapus ulang...")
|
||||
print(f" Sisa {remaining} entry, menghapus ulang... (round {attempt + 1})")
|
||||
else:
|
||||
print(f" Gagal verifikasi, lanjut...")
|
||||
break
|
||||
else:
|
||||
print(f" Warning: address-list mungkin belum sepenuhnya bersih setelah 10 percobaan")
|
||||
print(f" Warning: address-list belum bersih setelah 100 percobaan")
|
||||
|
||||
import time
|
||||
time.sleep(1)
|
||||
|
||||
Reference in New Issue
Block a user