Skip to content

Commit 01a706f

Browse files
authored
Merge pull request SciSharp#1371 from yileicn/master
Revert "feat: add scheduled instruction log cleanup via crontab hook"
2 parents 7f9a028 + 372df41 commit 01a706f

6 files changed

Lines changed: 0 additions & 120 deletions

File tree

src/Infrastructure/BotSharp.Abstraction/Repositories/IBotSharpRepository.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,6 @@ Task<DateTimePagination<ConversationStateLogModel>> GetConversationStateLogs(str
201201
#region Log Cleanup
202202
Task<int> DeleteOldConversationLogs(int retentionDays, int batchSize)
203203
=> throw new NotImplementedException();
204-
205-
Task<int> DeleteOldInstructionLogs(int retentionDays, int batchSize)
206-
=> throw new NotImplementedException();
207204
#endregion
208205

209206
#region Instruction Log

src/Infrastructure/BotSharp.Core/Repository/FileRepository/FileRepository.Log.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,6 @@ public async Task<int> DeleteOldConversationLogs(int retentionDays, int batchSiz
185185
// as it's typically used for local dev. Implementing it would require iterating all conversations.
186186
return await Task.FromResult(0);
187187
}
188-
189-
public async Task<int> DeleteOldInstructionLogs(int retentionDays, int batchSize = 2000)
190-
{
191-
// For file repository, keep the same cleanup behavior as conversation logs.
192-
return await Task.FromResult(0);
193-
}
194188
#endregion
195189

196190
#region Instruction Log

src/Infrastructure/BotSharp.OpenAPI/BotSharpOpenApiExtensions.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,6 @@ public static IServiceCollection AddCrontabServices(this IServiceCollection serv
238238
services.AddScoped<ICrontabHook, ConversationLogCleanupCrontabHook>();
239239
services.AddScoped<ICrontabSource, ConversationLogCleanupRuleTrigger>();
240240
services.AddScoped<IRuleTrigger, ConversationLogCleanupRuleTrigger>();
241-
242-
services.AddScoped<ICrontabHook, InstructionLogCleanupCrontabHook>();
243-
services.AddScoped<ICrontabSource, InstructionLogCleanupRuleTrigger>();
244-
services.AddScoped<IRuleTrigger, InstructionLogCleanupRuleTrigger>();
245241
return services;
246242
}
247243

src/Infrastructure/BotSharp.OpenAPI/Hooks/InstructionLogCleanupCrontabHook.cs

Lines changed: 0 additions & 65 deletions
This file was deleted.

src/Infrastructure/BotSharp.OpenAPI/RuleTriggers/InstructionLogCleanupRuleTrigger.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.Log.cs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -168,23 +168,6 @@ public async Task<int> DeleteOldConversationLogs(int retentionDays, int batchSiz
168168

169169
return (int)(contentDeletedCount + stateDeletedCount);
170170
}
171-
172-
public async Task<int> DeleteOldInstructionLogs(int retentionDays, int batchSize)
173-
{
174-
if (retentionDays <= 0) return 0;
175-
var threshold = DateTime.UtcNow.AddDays(-retentionDays);
176-
177-
var filter = Builders<InstructionLogDocument>.Filter.Lt(x => x.CreatedTime, threshold);
178-
var docsToDelete = await _dc.InstructionLogs.Find(filter).Limit(batchSize).Project(x => x.Id).ToListAsync();
179-
if (!docsToDelete.Any())
180-
{
181-
return 0;
182-
}
183-
184-
var deleteFilter = Builders<InstructionLogDocument>.Filter.In(x => x.Id, docsToDelete);
185-
var deleted = await _dc.InstructionLogs.DeleteManyAsync(deleteFilter);
186-
return (int)deleted.DeletedCount;
187-
}
188171
#endregion
189172

190173
#region Instruction Log

0 commit comments

Comments
 (0)