fix: forgot to complete inner pipe

This commit is contained in:
Renjaya Raga Zenta 2025-07-30 23:57:51 +07:00
parent 0206cc8ad6
commit 9920d21ad8

View file

@ -67,8 +67,6 @@ app.MapPost("/api/image/generate", (Stitch request, IMemoryCache cache) =>
if( value is string path )
File.Delete(path);
});
logger.ZLogDebug($"save cache key: {cacheKey}, file: {newCacheFile}");
cache.Set(cacheKey!, newCacheFile, cacheEntryOptions);
await using FileStream cacheStream = new(newCacheFile, FileMode.Create, FileAccess.Write, FileShare.Read);
while( true )
@ -83,8 +81,11 @@ app.MapPost("/api/image/generate", (Stitch request, IMemoryCache cache) =>
if( result.IsCompleted )
break;
}
logger.ZLogDebug($"save cache key: {cacheKey}, file: {newCacheFile}");
cache.Set(cacheKey, newCacheFile, cacheEntryOptions);
});
image?.WriteToStream(innerPipe.Writer.AsStream(), ".png");
await innerPipe.Writer.CompleteAsync();
}
catch( Exception e )
{