mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-18 01:57:59 +00:00
Reduced memory usage and fixed several memory leaks (#933)
Build and Release / Determine run mode (push) Has been cancelled
Build and Release / Read metadata (push) Has been cancelled
Build and Release / Sync Flatpak repo (push) Has been cancelled
Build and Release / Collect Flatpak artifacts (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Has been cancelled
Build and Release / Prepare & create release (push) Has been cancelled
Build and Release / Publish release (push) Has been cancelled
Build and Release / Determine run mode (push) Has been cancelled
Build and Release / Read metadata (push) Has been cancelled
Build and Release / Sync Flatpak repo (push) Has been cancelled
Build and Release / Collect Flatpak artifacts (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Has been cancelled
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Has been cancelled
Build and Release / Prepare & create release (push) Has been cancelled
Build and Release / Publish release (push) Has been cancelled
This commit is contained in:
1 parent
902a01a4d0
commit
7d9a4f5ab1
51 files changed
+531
-85
No files matched your search
+5
@@ -138,6 +138,11 @@ public partial class VisualBriefingAssistant
|
||||
this.MediaTranscriptionService.ClearOwnerState(MediaImportOwner.ForVisualBriefing(id));
|
||||
await this.Store.DeleteAsync(id);
|
||||
await this.Store.ForgetSelectionAsync(id);
|
||||
|
||||
// The briefing is gone, so neither its build state nor its progress snapshot is of use:
|
||||
this.BuildOrchestrator.ForgetBriefing(id);
|
||||
this.BuildProgressService.Forget(id);
|
||||
|
||||
this.ClearSelectedProject();
|
||||
|
||||
await this.ReloadListAsync();
|
||||
|
||||
@@ -158,7 +158,7 @@ public partial class VisualBriefingAssistant : MSGComponentBase
|
||||
await this.ReloadListAsync();
|
||||
await this.ConsumePendingMediaOutcomesAsync();
|
||||
_ = this.MonitorSourceStatusAsync(this.sourceMonitorCancellation.Token);
|
||||
var deferredInstruction = this.MessageBus.CheckDeferredMessages<string>(Event.SEND_TO_VISUAL_BRIEFING_ASSISTANT).FirstOrDefault();
|
||||
var deferredInstruction = this.MessageBus.TakeDeferredMessages<string>(Event.SEND_TO_VISUAL_BRIEFING_ASSISTANT).LastOrDefault();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(deferredInstruction))
|
||||
{
|
||||
|
||||
@@ -63,6 +63,21 @@ internal sealed partial class VisualBriefingBuildOrchestrator
|
||||
public VisualBriefingOperationDiagnostics? GetDiagnostics(Guid briefingId) =>
|
||||
this.liveDiagnostics.GetValueOrDefault(briefingId);
|
||||
|
||||
/// <summary>
|
||||
/// Drops what we kept for a briefing which does not exist anymore.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Both dictionaries only ever grew: every briefing which was built once stayed in them for as
|
||||
/// long as the app was running. The build lock is not disposed, because another build might
|
||||
/// still wait on it.
|
||||
/// </remarks>
|
||||
/// <param name="briefingId">The identifier of the deleted briefing.</param>
|
||||
public void ForgetBriefing(Guid briefingId)
|
||||
{
|
||||
this.buildLocks.TryRemove(briefingId, out _);
|
||||
this.liveDiagnostics.TryRemove(briefingId, out _);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds or resumes a visual briefing operation.
|
||||
/// </summary>
|
||||
|
||||
+10
@@ -33,4 +33,14 @@ public sealed class VisualBriefingBuildProgressService
|
||||
/// </summary>
|
||||
public VisualBriefingBuildRecord? GetLatest(Guid briefingId) =>
|
||||
this.latest.GetValueOrDefault(briefingId);
|
||||
|
||||
/// <summary>
|
||||
/// Drops the snapshot of a briefing which does not exist anymore.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A snapshot is a complete build record. Without this, every briefing which was ever built
|
||||
/// kept one for as long as the app was running.
|
||||
/// </remarks>
|
||||
/// <param name="briefingId">The identifier of the deleted briefing.</param>
|
||||
public void Forget(Guid briefingId) => this.latest.TryRemove(briefingId, out _);
|
||||
}
|
||||
@@ -398,6 +398,7 @@ public sealed partial class VisualBriefingStore
|
||||
finally
|
||||
{
|
||||
gate.Release();
|
||||
this.ForgetLock(briefingId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -167,6 +167,16 @@ public sealed partial class VisualBriefingStore(
|
||||
/// </summary>
|
||||
private SemaphoreSlim GetLock(Guid briefingId) => this.briefingLocks.GetOrAdd(briefingId, _ => new(1, 1));
|
||||
|
||||
/// <summary>
|
||||
/// Drops the lock of a briefing which does not exist anymore.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Otherwise, this dictionary keeps one entry per briefing the app ever touched. We do not
|
||||
/// dispose the semaphore: another operation might still wait on it, and disposing it under
|
||||
/// their feet would turn a deleted briefing into an exception somewhere else.
|
||||
/// </remarks>
|
||||
private void ForgetLock(Guid briefingId) => this.briefingLocks.TryRemove(briefingId, out _);
|
||||
|
||||
/// <summary>
|
||||
/// Defines <c>BriefingDirectory</c> for the visual briefing feature.
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user