Skip to content

Commit

Permalink
Adjust cancellationtoken
Browse files Browse the repository at this point in the history
  • Loading branch information
Webreaper committed Apr 26, 2024
1 parent bf63052 commit a6f3fc4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Damselfly.Web.Server/Controllers/ImageController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,16 @@ public async Task<IActionResult> Thumb(string thumbSize, string imageId, Cancell
IActionResult result = Redirect("/no-image.png");

if ( Enum.TryParse<ThumbSize>(thumbSize, true, out var size) && int.TryParse(imageId, out var id) )
{
try
{
Logging.LogTrace($"Controller - Getting Thumb for {imageId}");

var image = await imageCache.GetCachedImage(id);

if ( cancel.IsCancellationRequested )
return result;

var image = await imageCache.GetCachedImage(id);

if ( image != null )
{
if ( cancel.IsCancellationRequested )
Expand Down Expand Up @@ -133,6 +134,7 @@ public async Task<IActionResult> Thumb(string thumbSize, string imageId, Cancell
{
Logging.LogError($"Unable to process /thumb/{thumbSize}/{imageId}: {ex.Message}");
}
}

watch.Stop();

Expand Down

0 comments on commit a6f3fc4

Please sign in to comment.