mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-06 17:10:13 +00:00
Fix permanently stopped IPC when ASF update has failed
This commit is contained in:
@@ -319,13 +319,17 @@ public static class ASF {
|
|||||||
|
|
||||||
await PluginsCore.OnUpdateProceeding(newVersion).ConfigureAwait(false);
|
await PluginsCore.OnUpdateProceeding(newVersion).ConfigureAwait(false);
|
||||||
|
|
||||||
try {
|
bool kestrelWasRunning = ArchiKestrel.IsRunning;
|
||||||
|
|
||||||
|
if (kestrelWasRunning) {
|
||||||
// We disable ArchiKestrel here as the update process moves the core files and might result in IPC crash
|
// We disable ArchiKestrel here as the update process moves the core files and might result in IPC crash
|
||||||
// TODO: It might fail if the update was triggered from the API, this should be something to improve in the future, by changing the structure into request -> return response -> finish update
|
// TODO: It might fail if the update was triggered from the API, this should be something to improve in the future, by changing the structure into request -> return response -> finish update
|
||||||
|
try {
|
||||||
await ArchiKestrel.Stop().ConfigureAwait(false);
|
await ArchiKestrel.Stop().ConfigureAwait(false);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ArchiLogger.LogGenericWarningException(e);
|
ArchiLogger.LogGenericWarningException(e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ArchiLogger.LogGenericInfo(Strings.PatchingFiles);
|
ArchiLogger.LogGenericInfo(Strings.PatchingFiles);
|
||||||
|
|
||||||
@@ -342,6 +346,16 @@ public static class ASF {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ArchiLogger.LogGenericException(e);
|
ArchiLogger.LogGenericException(e);
|
||||||
|
|
||||||
|
if (kestrelWasRunning) {
|
||||||
|
// We've temporarily disabled ArchiKestrel but the update has failed, let's bring it back up
|
||||||
|
// We can't even be sure if it's possible to bring it back up in this state, but it's worth trying anyway
|
||||||
|
try {
|
||||||
|
await ArchiKestrel.Start().ConfigureAwait(false);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ArchiLogger.LogGenericWarningException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ using NLog.Web;
|
|||||||
namespace ArchiSteamFarm.IPC;
|
namespace ArchiSteamFarm.IPC;
|
||||||
|
|
||||||
internal static class ArchiKestrel {
|
internal static class ArchiKestrel {
|
||||||
|
internal static bool IsRunning => KestrelWebHost != null;
|
||||||
|
|
||||||
internal static HistoryTarget? HistoryTarget { get; private set; }
|
internal static HistoryTarget? HistoryTarget { get; private set; }
|
||||||
|
|
||||||
private static IHost? KestrelWebHost;
|
private static IHost? KestrelWebHost;
|
||||||
|
|||||||
Reference in New Issue
Block a user