|
|
@ -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.") |
|
|
|