Chore(booking-job): Optimise maintenance animation sleep
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:
@@ -406,13 +406,15 @@ func selectBookingSlot(ctx context.Context, page *rod.Page, timeCode string) *ro
|
|||||||
selectButtonElement := rowElement.MustElement("a")
|
selectButtonElement := rowElement.MustElement("a")
|
||||||
selectButtonElement.Eval(`this.click()`)
|
selectButtonElement.Eval(`this.click()`)
|
||||||
|
|
||||||
time.Sleep(1000 * time.Millisecond)
|
|
||||||
page.MustWaitLoad()
|
page.MustWaitLoad()
|
||||||
|
|
||||||
// Check before exiting
|
// Check before exiting
|
||||||
bodyText := page.MustElement("body").MustText()
|
bodyText := page.MustElement("body").MustText()
|
||||||
if strings.Contains(bodyText, "System maintenance scheduled at 23:00 to 00:15 (UTC+8).") {
|
if strings.Contains(bodyText, "System maintenance scheduled at 23:00 to 00:15 (UTC+8).") {
|
||||||
completed = false
|
completed = false
|
||||||
|
|
||||||
|
// TODO: Test if it is okay to sleep after checking for maintenance
|
||||||
|
time.Sleep(1000 * time.Millisecond)
|
||||||
closeModalButton := page.MustElement("#popupModalCloseButton")
|
closeModalButton := page.MustElement("#popupModalCloseButton")
|
||||||
closeModalButton.Eval(`this.click()`)
|
closeModalButton.Eval(`this.click()`)
|
||||||
time.Sleep(1000 * time.Millisecond)
|
time.Sleep(1000 * time.Millisecond)
|
||||||
|
|||||||
Reference in New Issue
Block a user