feat: updated dependency api

This commit is contained in:
Marvin Zhang
2024-11-06 17:15:45 +08:00
parent 75fdc863a6
commit 7731e321ed
2 changed files with 5 additions and 1 deletions

View File

@@ -100,7 +100,10 @@ func (svr DependencyServiceServer) Sync(_ context.Context, request *grpc.Depende
for _, d := range depsDb {
_, ok := depsMap[d.Name]
if !ok {
depIdsToDelete = append(depIdsToDelete, d.Id)
// Only delete dependencies that are uninstalled/error/abnormal and older than 7 days
if d.Status != constants.DependencyStatusInstalled && time.Since(d.UpdatedAt) > 7*24*time.Hour {
depIdsToDelete = append(depIdsToDelete, d.Id)
}
}
}