Skip to content

Commit

Permalink
Preliminary bug fixes for pauses in macros
Browse files Browse the repository at this point in the history
  • Loading branch information
chrishamm committed Sep 17, 2024
1 parent 9b047be commit fa674a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/DuetControlServer/Codes/Pipelines/ProcessInternally.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using DuetAPI.Commands;
using DuetAPI;
using DuetAPI.Commands;
using DuetAPI.Connection;
using System;
using System.Threading.Tasks;
Expand Down Expand Up @@ -33,6 +34,12 @@ public override async Task ProcessCodeAsync(Commands.Code code)
}
catch (Exception e)
{
if (e is CodeParserException && code.CancellationToken.IsCancellationRequested)
{
// We may get here when a code is cancelled while an evaluation request is being processed
e = new OperationCanceledException();
}

if (e is not OperationCanceledException)
{
Processor.Logger.Error(e, "Failed to execute code {0} on internal processing stage", code);
Expand Down
4 changes: 2 additions & 2 deletions src/DuetControlServer/SPI/Channel/Processor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1286,8 +1286,8 @@ public void PrintPaused()
// Invalidate pending requests
InvalidateRegular();

// Clear pausable macros
while (CurrentState.File is MacroFile { IsPausable: true })
// Clear macros. When we get here, RRF has done the same
while (CurrentState.File is MacroFile)
{
Pop();
}
Expand Down

0 comments on commit fa674a2

Please sign in to comment.