Feat(booking-job): Added sleep before allowing retry
All checks were successful
ktm-booking-bot/ktm-booking-bot/pipeline/head This commit looks good
All checks were successful
ktm-booking-bot/ktm-booking-bot/pipeline/head This commit looks good
This commit is contained in:
@@ -104,10 +104,12 @@ func (env *Env) BackgroundJobRunner() {
|
|||||||
}()
|
}()
|
||||||
success := env.startBooking(&jobToDo, username, password, creditCardType, creditCard, creditCardCVV, creditCardExpiry)
|
success := env.startBooking(&jobToDo, username, password, creditCardType, creditCard, creditCardCVV, creditCardExpiry)
|
||||||
if success {
|
if success {
|
||||||
fmt.Println("Successfully made a booking.")
|
|
||||||
jobToDo.Status = "success"
|
jobToDo.Status = "success"
|
||||||
env.DB.Save(jobToDo)
|
env.DB.Save(jobToDo)
|
||||||
|
fmt.Println("Successfully made a booking.")
|
||||||
} else {
|
} else {
|
||||||
|
// Sleep for 10 minutes before setting status to pending
|
||||||
|
time.Sleep(10 * time.Minute)
|
||||||
jobToDo.Status = "pending"
|
jobToDo.Status = "pending"
|
||||||
env.DB.Save(&jobToDo)
|
env.DB.Save(&jobToDo)
|
||||||
fmt.Println("Failed to make a booking.")
|
fmt.Println("Failed to make a booking.")
|
||||||
|
|||||||
Reference in New Issue
Block a user