Feat(booking-job): Handle seat retries
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:
@@ -318,9 +318,8 @@ func (env *Env) startBooking(job *Booking, username string, password string, cre
|
||||
// // Defer done with debug screenshot
|
||||
// defer cancelDebugScreenshot()
|
||||
|
||||
time.Sleep(600 * time.Second)
|
||||
time.Sleep(10 * time.Second)
|
||||
_ = page
|
||||
browser.MustClose()
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -435,6 +434,15 @@ func selectBookingSlot(ctx context.Context, page *rod.Page, timeCode string) *ro
|
||||
time.Sleep(1000 * time.Millisecond)
|
||||
}
|
||||
|
||||
// Repeat if there's no seats -- seats might be released later
|
||||
if strings.Contains(bodyText, "Not enough seat for onward trip") {
|
||||
completed = false
|
||||
|
||||
closeModalButton := page.MustElement("#popupModalCloseButton")
|
||||
closeModalButton.Eval(`this.click()`)
|
||||
time.Sleep(1000 * time.Millisecond)
|
||||
}
|
||||
|
||||
styleAttribute := selectButtonElement.MustAttribute("style")
|
||||
if styleAttribute == nil || !strings.Contains(*styleAttribute, "display: none") {
|
||||
completed = false
|
||||
|
||||
Reference in New Issue
Block a user