Skip to content

Commit 3007dcf

Browse files
authored
more coderabbitai improvements
1 parent 4c9b735 commit 3007dcf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pio-scripts/inject_syslog_ui.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def set_syslog_state(project_dir, enabled):
7474
</div>
7575
"""
7676

77-
def inject_syslog_ui(source, target, env):
77+
def inject_syslog_ui(source, target, env, retry_count=0):
7878
print("\033[44m==== inject_syslog_ui.py (PRE BUILD) ====\033[0m")
7979
if not is_full_build:
8080
print("\033[43mNot a full build, skipping Syslog UI operations.\033[0m")
@@ -155,7 +155,11 @@ def inject_syslog_ui(source, target, env):
155155
if '<!-- SYSLOG-START -->' not in content or '<!-- SYSLOG-END -->' not in content:
156156
print("Backup exists but SYSLOG markers missing—forcing re-injection.")
157157
os.remove(bak)
158-
inject_syslog_ui(source, target, env)
158+
# only retry up to 3 times
159+
if retry_count < 3:
160+
inject_syslog_ui(source, target, env, retry_count + 1)
161+
else:
162+
print("\033[41mToo many retry attempts. Manual intervention required.\033[0m")
159163
else:
160164
print("Backup exists and markers found; already injected.")
161165

0 commit comments

Comments
 (0)