Commit 48b2f0a
fix: prevent repeated 'Process Completed' messages after LLM translation
Root cause: setInterval with async callbacks does not prevent overlapping
execution. pywebview's message queue backs up during heavy LLM token
streaming (dense stdout from local LLM). When the process exits and load
drops, all backed-up get_process_status() calls resolve simultaneously —
each sees status='completed' and each calls ErrorHandler.showSuccess,
printing the success message many times.
Fix: add a guard immediately after each `await pywebview.api.*` call that
checks `AppState.statusPollInterval` (or logPollInterval). The first
callback to handle completion calls stopStatusMonitoring() which sets
the ref to null. All subsequent in-flight callbacks see null and return
early, executing the completion handler exactly once.
Applied to both startStatusMonitoring (500ms) and startLogPolling (100ms).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 541ba29 commit 48b2f0a
1 file changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
949 | 949 | | |
950 | 950 | | |
951 | 951 | | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
952 | 955 | | |
953 | 956 | | |
954 | 957 | | |
| |||
978 | 981 | | |
979 | 982 | | |
980 | 983 | | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
981 | 992 | | |
982 | 993 | | |
983 | 994 | | |
| |||
0 commit comments