new: keepStatusWhenErr

This commit is contained in:
lollipopkit
2024-02-20 10:44:05 +08:00
parent 8fa3a2d0e4
commit 7557bacb60
15 changed files with 78 additions and 0 deletions

View File

@@ -388,6 +388,12 @@ class ServerProvider extends ChangeNotifier {
raw = await s.client?.run(ShellFunc.status.exec).string;
segments = raw?.split(seperator).map((e) => e.trim()).toList();
if (raw == null || raw.isEmpty || segments == null || segments.isEmpty) {
if (Stores.setting.keepStatusWhenErr.fetch()) {
// Keep previous server status when err occurs
if (s.state != ServerState.failed && s.status.more.isNotEmpty) {
return;
}
}
TryLimiter.inc(sid);
s.status.err = 'Seperate segments failed, raw:\n$raw';
_setServerState(s, ServerState.failed);

View File

@@ -230,6 +230,9 @@ class SettingStore extends PersistentStore {
/// Try to use `sudo` to run docker command
late final containerTrySudo = property('containerTrySudo', true);
/// Keep previous server status when err occurs
late final keepStatusWhenErr = property('keepStatusWhenErr', false);
// Never show these settings for users
//
// ------BEGIN------