Add index creation
This commit is contained in:
@@ -51,15 +51,8 @@ func runCifFullDownload(cfg *helpers.Configuration) error {
|
||||
// Set parsed to nil to encourage garbage collection
|
||||
parsed = nil
|
||||
|
||||
// Clear out of date schedules
|
||||
cutoff := time.Now().Add(-time.Hour * 24 * 7)
|
||||
log.Debug("Attempting to remove outdated services", zap.Time("scheduleEnd before", cutoff))
|
||||
count, err := dbAccess.RemoveOutdatedServices(cutoff)
|
||||
if err != nil {
|
||||
log.Warn("Out of date services not removed", zap.Error(err))
|
||||
} else {
|
||||
log.Info("Out of date services removed", zap.Int64("removal count", count))
|
||||
}
|
||||
// Create Indexes
|
||||
dbAccess.CreateTimetableIndexes()
|
||||
|
||||
postTime := time.Now()
|
||||
updateDuration := postTime.Sub(preTime)
|
||||
@@ -111,11 +104,22 @@ func runCifUpdateDownload(cfg *helpers.Configuration, metadata *dbAccess.CifMeta
|
||||
parsed = nil
|
||||
}
|
||||
|
||||
// Write metadata to database
|
||||
ok := dbAccess.PutCifMetadata(metadata, dailyUpdateType)
|
||||
if !ok {
|
||||
log.Warn("CIF Data updated, but metadata write failed.")
|
||||
}
|
||||
|
||||
// Clear out of date schedules
|
||||
cutoff := time.Now().Add(-time.Hour * 24 * 7)
|
||||
log.Debug("Attempting to remove outdated services", zap.Time("scheduleEnd before", cutoff))
|
||||
count, err := dbAccess.RemoveOutdatedServices(cutoff)
|
||||
if err != nil {
|
||||
log.Warn("Out of date services not removed", zap.Error(err))
|
||||
} else {
|
||||
log.Info("Out of date services removed", zap.Int64("removal count", count))
|
||||
}
|
||||
|
||||
endTime := time.Now()
|
||||
duration := endTime.Sub(startTime)
|
||||
log.Info("CIF Update process ended", zap.Duration("duration", duration))
|
||||
|
||||
Reference in New Issue
Block a user