in workload-management/s3-trigger-ecs-task/s3-file-processor/utils/FileHelper.go [75:107]
func DeleteProcessedData() {
outputFilePath := GetOutputFile(false)
if Exists(outputFilePath) {
outputFile, err := os.Open(outputFilePath)
if err != nil {
log.Printf("Error while opening the file %s", err.Error())
}
defer outputFile.Close()
reader := csv.NewReader(outputFile)
var orders []string
index := 0
for {
record, errRead := reader.Read()
if errRead == io.EOF {
DeleteItems(orders)
break
}
index++
// Batch to 25 records at a time
if index == MaxRecordsPerBatch {
DeleteItems(orders)
// Trim data
orders = orders[:0]
index = 0
} else {
orders = append(orders, record[0])
}
}
}
}