Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,6 @@ Task<DateTimePagination<ConversationStateLogModel>> GetConversationStateLogs(str
#region Log Cleanup
Task<int> DeleteOldConversationLogs(int retentionDays, int batchSize)
=> throw new NotImplementedException();

Task<int> DeleteOldInstructionLogs(int retentionDays, int batchSize)
=> throw new NotImplementedException();
#endregion

#region Instruction Log
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,6 @@ public async Task<int> DeleteOldConversationLogs(int retentionDays, int batchSiz
// as it's typically used for local dev. Implementing it would require iterating all conversations.
return await Task.FromResult(0);
}

public async Task<int> DeleteOldInstructionLogs(int retentionDays, int batchSize = 2000)
{
// For file repository, keep the same cleanup behavior as conversation logs.
return await Task.FromResult(0);
}
#endregion

#region Instruction Log
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,6 @@ public static IServiceCollection AddCrontabServices(this IServiceCollection serv
services.AddScoped<ICrontabHook, ConversationLogCleanupCrontabHook>();
services.AddScoped<ICrontabSource, ConversationLogCleanupRuleTrigger>();
services.AddScoped<IRuleTrigger, ConversationLogCleanupRuleTrigger>();

services.AddScoped<ICrontabHook, InstructionLogCleanupCrontabHook>();
services.AddScoped<ICrontabSource, InstructionLogCleanupRuleTrigger>();
services.AddScoped<IRuleTrigger, InstructionLogCleanupRuleTrigger>();
return services;
}

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -168,23 +168,6 @@ public async Task<int> DeleteOldConversationLogs(int retentionDays, int batchSiz

return (int)(contentDeletedCount + stateDeletedCount);
}

public async Task<int> DeleteOldInstructionLogs(int retentionDays, int batchSize)
{
if (retentionDays <= 0) return 0;
var threshold = DateTime.UtcNow.AddDays(-retentionDays);

var filter = Builders<InstructionLogDocument>.Filter.Lt(x => x.CreatedTime, threshold);
var docsToDelete = await _dc.InstructionLogs.Find(filter).Limit(batchSize).Project(x => x.Id).ToListAsync();
if (!docsToDelete.Any())
{
return 0;
}

var deleteFilter = Builders<InstructionLogDocument>.Filter.In(x => x.Id, docsToDelete);
var deleted = await _dc.InstructionLogs.DeleteManyAsync(deleteFilter);
return (int)deleted.DeletedCount;
}
#endregion

#region Instruction Log
Expand Down
Loading