|
|
@ -77,7 +77,7 @@ func (env *Env) BackgroundJobRunner() { |
|
|
|
} else { // if there's job to do
|
|
|
|
// Create next run where it's not the past (either from old NextRun or now())
|
|
|
|
timeNow := time.Now() |
|
|
|
startTime := time.Date(timeNow.Year(), timeNow.Month(), timeNow.Day(), 0, 10, 0, 0, timeNow.Location()) |
|
|
|
startTime := time.Date(timeNow.Year(), timeNow.Month(), timeNow.Day(), 23, 07, 0, 0, timeNow.Location()) |
|
|
|
endTime := startTime.Add(10 * time.Minute) |
|
|
|
|
|
|
|
if timeNow.After(startTime) && timeNow.Before(endTime) { |
|
|
@ -407,14 +407,13 @@ func selectBookingSlot(ctx context.Context, page *rod.Page, timeCode string) *ro |
|
|
|
selectButtonElement.Eval(`this.click()`) |
|
|
|
|
|
|
|
page.MustWaitLoad() |
|
|
|
time.Sleep(500 * time.Millisecond) |
|
|
|
|
|
|
|
// Check before exiting
|
|
|
|
bodyText := page.MustElement("body").MustText() |
|
|
|
if strings.Contains(bodyText, "System maintenance scheduled at 23:00 to 00:15 (UTC+8).") { |
|
|
|
completed = false |
|
|
|
|
|
|
|
// TODO: Test if it is okay to sleep after checking for maintenance
|
|
|
|
time.Sleep(1000 * time.Millisecond) |
|
|
|
closeModalButton := page.MustElement("#popupModalCloseButton") |
|
|
|
closeModalButton.Eval(`this.click()`) |
|
|
|
time.Sleep(1000 * time.Millisecond) |
|
|
|