Files
LiquidCode.Tester/src/LiquidCode.Tester.Gateway/Services/IPackageDownloadService.cs
Roman Pytkov bf7bd0ad6b
All checks were successful
Build and Push Docker Images / build (src/LiquidCode.Tester.Gateway/Dockerfile, git.nullptr.top/liquidcode/liquidcode-tester-gateway-roman, gateway) (push) Successful in 53s
Build and Push Docker Images / build (src/LiquidCode.Tester.Worker/Dockerfile, git.nullptr.top/liquidcode/liquidcode-tester-worker-roman, worker) (push) Successful in 50s
Improves package download and caching
Adds package caching to reduce download frequency.

Introduces a `PackageDownloadService` with memory caching to store downloaded packages,
identified by mission ID, for reuse. Uses concurrent locks to prevent race conditions during download.

Modifies the worker client service to optionally delete the package after sending,
allowing cached packages to be retained.
2025-11-02 20:05:50 +03:00

13 lines
540 B
C#

namespace LiquidCode.Tester.Gateway.Services;
public interface IPackageDownloadService
{
/// <summary>
/// Retrieves a cached package for the mission or downloads it if missing.
/// </summary>
/// <param name="missionId">Unique mission identifier used as cache key.</param>
/// <param name="packageUrl">URL to download the package from when cache is cold.</param>
/// <returns>Path to the cached or downloaded package file.</returns>
Task<string> GetOrDownloadPackageAsync(long missionId, string packageUrl);
}