Skip to content

Commit

Permalink
Restart RecipeNote solving if it was stopped halfway through
Browse files Browse the repository at this point in the history
  • Loading branch information
WorkingRobot committed Nov 15, 2023
1 parent 36df0af commit ca92a78
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Craftimizer/Windows/RecipeNote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ public override bool DrawConditions()
{
if (wasOpen)
BestMacroTokenSource?.Cancel();
else
{
if (!BestSuggestedMacro.HasValue && CraftStatus == CraftableStatus.OK && BestMacroTokenSource == null)
CalculateBestMacros();
}
}

wasOpen = isOpen;
Expand Down Expand Up @@ -172,7 +177,7 @@ private bool ShouldDraw()
statsChanged = true;
}

if ((statsChanged || (BestMacroTokenSource?.IsCancellationRequested ?? false)) && CraftStatus == CraftableStatus.OK)
if (statsChanged && CraftStatus == CraftableStatus.OK)
CalculateBestMacros();

return true;
Expand Down

1 comment on commit ca92a78

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: ca92a78 Previous: a8c3f34 Ratio
Craftimizer.Benchmark.Bench.Solve(State: 808D1458, Config: 390E45D9) 1558008100 ns (± 3175949.7479381775)
Craftimizer.Benchmark.Bench.Solve(State: 808D1458, Config: 390E45D9) 1186317673.3333333 ns (± 3759917.4617587146)
Craftimizer.Benchmark.Bench.Solve(State: CCF77A02, Config: 390E45D9) 1582064793.3333333 ns (± 3338237.8004113543)
Craftimizer.Benchmark.Bench.Solve(State: CCF77A02, Config: 390E45D9) 1215474513.3333333 ns (± 2400564.5945624267)

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.