Cleanup
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Musify.Application.Configuration
|
||||
{
|
||||
@@ -69,7 +69,6 @@ namespace Musify.Application.Configuration
|
||||
|
||||
public string BuildLargePicturePath(string pictureName) => CombineKey(ParentFolders, LargePicturesFolder, pictureName);
|
||||
|
||||
// Temp path used in Phase 2 for pre-signed upload keys (moved to final on consumption)
|
||||
public string BuildTempPicturePath(string tempRootPrefix, long userId, string objectName) =>
|
||||
CombineKey(tempRootPrefix, userId.ToString(), ParentFolders, objectName);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Musify.Application.Configuration
|
||||
{
|
||||
@@ -85,7 +85,6 @@ namespace Musify.Application.Configuration
|
||||
|
||||
public string BuildProcessedAudioPath(string audioName) => CombineKey(ProcessedAudiosPath, audioName);
|
||||
|
||||
// Temp paths used in Phase 2 for pre-signed upload keys (moved to final on consumption)
|
||||
public string BuildTempPicturePath(string tempRootPrefix, long userId, string objectName) =>
|
||||
CombineKey(tempRootPrefix, userId.ToString(), ParentFolder, objectName);
|
||||
|
||||
|
||||
@@ -6,47 +6,37 @@ namespace Musify.Application.Configuration
|
||||
{
|
||||
public const string SectionName = "UploadIntent";
|
||||
|
||||
// Pre-signed URL TTL in seconds
|
||||
[Range(10, 3600)]
|
||||
public int UploadUrlExpiresInSeconds { get; set; } = 120;
|
||||
|
||||
// Max concurrent Issued intents per user
|
||||
[Range(1, 100)]
|
||||
public int MaxActiveUploadIntentsPerUser { get; set; } = 5;
|
||||
|
||||
// Max total bytes across all Issued intents for a user (default 200MB)
|
||||
[Range(1, long.MaxValue)]
|
||||
public long MaxActiveUploadBytesPerUser { get; set; } = 200L * 1024 * 1024;
|
||||
|
||||
// Max size validated via HEAD before consuming an intent (default 100MB)
|
||||
[Range(1, long.MaxValue)]
|
||||
public long MaxUploadBytes { get; set; } = 100L * 1024 * 1024;
|
||||
|
||||
// Conservative fallback size used when ExpectedSizeBytes is not provided
|
||||
[Range(1, long.MaxValue)]
|
||||
public long DefaultExpectedPictureSizeBytes { get; set; } = 10L * 1024 * 1024; // 10MB
|
||||
public long DefaultExpectedPictureSizeBytes { get; set; } = 10L * 1024 * 1024;
|
||||
|
||||
[Range(1, long.MaxValue)]
|
||||
public long DefaultExpectedAudioSizeBytes { get; set; } = 100L * 1024 * 1024; // 100MB
|
||||
public long DefaultExpectedAudioSizeBytes { get; set; } = 100L * 1024 * 1024;
|
||||
|
||||
// How often the expiration job runs
|
||||
[Range(30, 86400)]
|
||||
public int ExpirationJobIntervalSeconds { get; set; } = 300;
|
||||
|
||||
// How many days to retain Expired intents before deleting the DB row
|
||||
[Range(0, 365)]
|
||||
public int ExpiredIntentsRetentionDays { get; set; } = 7;
|
||||
|
||||
// Root S3 prefix for temporary uploads (Phase 2)
|
||||
[Required, MinLength(1)]
|
||||
public string TempRootPrefix { get; set; } = "temp";
|
||||
public string TemporalRootPrefix { get; set; } = "temporal";
|
||||
|
||||
// How many days to retain orphaned temp objects in S3 before the cleanup job deletes them
|
||||
[Range(1, 30)]
|
||||
public int TempUploadsRetentionDays { get; set; } = 3;
|
||||
public int TemporalUploadsRetentionDays { get; set; } = 3;
|
||||
|
||||
// How often the temp-upload cleanup job runs
|
||||
[Range(60, 86400)]
|
||||
public int TempCleanupJobIntervalSeconds { get; set; } = 3600;
|
||||
public int TemporalCleanUpJobIntervalSeconds { get; set; } = 3600;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Musify.Application.PlayLists.Handlers
|
||||
var objectName = $"{Guid.NewGuid() }.{request.FileType.TrimStart('.').ToLowerInvariant() }";
|
||||
|
||||
var tempKey = playListConfiguration.Routes.BuildTempPicturePath(
|
||||
uploadIntentConfiguration.TempRootPrefix, request.UserId, objectName);
|
||||
uploadIntentConfiguration.TemporalRootPrefix, request.UserId, objectName);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -42,9 +42,9 @@ namespace Musify.Application.Tracks.Handlers
|
||||
var audioObjectName = $"{Guid.NewGuid()}.{request.AudioFileType.TrimStart('.').ToLowerInvariant()}";
|
||||
|
||||
var tempPictureKey = trackConfiguration.Routes.BuildTempPicturePath(
|
||||
uploadIntentConfiguration.TempRootPrefix, request.UserId, pictureObjectName);
|
||||
uploadIntentConfiguration.TemporalRootPrefix, request.UserId, pictureObjectName);
|
||||
var tempAudioKey = trackConfiguration.Routes.BuildTempAudioPath(
|
||||
uploadIntentConfiguration.TempRootPrefix, request.UserId, audioObjectName);
|
||||
uploadIntentConfiguration.TemporalRootPrefix, request.UserId, audioObjectName);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user