Feat(booking-job): Added sleep before allowing retry
All checks were successful
ktm-booking-bot/ktm-booking-bot/pipeline/head This commit looks good

This commit is contained in:
2022-09-30 23:22:04 +08:00
parent bbbacfffe9
commit 0f50ddfeb7

View File

@@ -104,10 +104,12 @@ func (env *Env) BackgroundJobRunner() {
}()
success := env.startBooking(&jobToDo, username, password, creditCardType, creditCard, creditCardCVV, creditCardExpiry)
if success {
fmt.Println("Successfully made a booking.")
jobToDo.Status = "success"
env.DB.Save(jobToDo)
fmt.Println("Successfully made a booking.")
} else {
// Sleep for 10 minutes before setting status to pending
time.Sleep(10 * time.Minute)
jobToDo.Status = "pending"
env.DB.Save(&jobToDo)
fmt.Println("Failed to make a booking.")