fix unnecessary config reload on save
This commit is contained in:
@@ -113,6 +113,7 @@ public class ConfigurationSaveService : IHostedService
|
|||||||
WriteIndented = true
|
WriteIndented = true
|
||||||
})).ConfigureAwait(false);
|
})).ConfigureAwait(false);
|
||||||
File.Move(temp, config.ConfigurationPath, true);
|
File.Move(temp, config.ConfigurationPath, true);
|
||||||
|
config.UpdateLastWriteTime();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,6 +37,11 @@ public abstract class ConfigurationServiceBase<T> : IConfigService<T> where T :
|
|||||||
ConfigSave?.Invoke(this, EventArgs.Empty);
|
ConfigSave?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateLastWriteTime()
|
||||||
|
{
|
||||||
|
_configLastWriteTime = GetConfigLastWriteTime();
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
protected virtual void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (!disposing || _disposed) return;
|
if (!disposing || _disposed) return;
|
||||||
|
|||||||
@@ -8,4 +8,5 @@ public interface IConfigService<out T> : IDisposable where T : IMareConfiguratio
|
|||||||
string ConfigurationName { get; }
|
string ConfigurationName { get; }
|
||||||
string ConfigurationPath { get; }
|
string ConfigurationPath { get; }
|
||||||
public event EventHandler? ConfigSave;
|
public event EventHandler? ConfigSave;
|
||||||
|
void UpdateLastWriteTime();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user