|
13 | 13 |
|
14 | 14 | nemp_logger = logging.getLogger("NEMPolling") |
15 | 15 |
|
| 16 | +MAX_POLL_FAILURES = 3 |
| 17 | + |
16 | 18 | help_dict = { |
17 | 19 | "running": [ |
18 | 20 | "{0} running <true/false>", |
|
50 | 52 | ], |
51 | 53 | "failedmods": [ |
52 | 54 | "{0} failedmods", |
53 | | - "Shows a list of mods that have failed to be polled at least 5 times in a row and were disabled automatically.", |
| 55 | + f"Shows a list of mods that have failed to be polled at least {MAX_POLL_FAILURES} times in a row" |
| 56 | + " and were disabled automatically.", |
54 | 57 | ], |
55 | 58 | "failcount": [ |
56 | 59 | "{0} failcount", |
57 | 60 | "Shows how many times mods have failed to be polled so far. At least two failures in a row required.", |
58 | | - "Mods that have failed being polled 5 times are excluded from this list. Check {0} failedmods for those mods.", |
| 61 | + f"Mods that have failed being polled {MAX_POLL_FAILURES} times are excluded from this list." |
| 62 | + " Check {0} failedmods for those mods.", |
59 | 63 | ], |
60 | 64 | "showinfo": [ |
61 | 65 | "{0} showinfo <mod> [<path> [...]]", |
@@ -217,15 +221,16 @@ async def polling_task(handle, _pipe): |
217 | 221 | plugin.troubled_mods[mod_name] += 1 |
218 | 222 | current_troubled_mods.remove(mod_name) |
219 | 223 |
|
220 | | - if plugin.troubled_mods[mod_name] >= 5: |
| 224 | + if plugin.troubled_mods[mod_name] >= MAX_POLL_FAILURES: |
221 | 225 | plugin.auto_disabled_mods[mod_name] = True |
222 | 226 | the_poller.mods[mod_name]["active"] = False |
223 | 227 | del plugin.troubled_mods[mod_name] |
224 | 228 |
|
225 | 229 | completely_failed_mods.append(mod_name) |
226 | 230 |
|
227 | 231 | nemp_logger.debug( |
228 | | - f"Mod {mod_name} has failed to be polled at least 5 times, it has been disabled." |
| 232 | + "Mod %s has failed to be polled at least %d times, it has been disabled.", |
| 233 | + mod_name, MAX_POLL_FAILURES, |
229 | 234 | ) |
230 | 235 |
|
231 | 236 | the_poller.build_html() |
|
0 commit comments