Skip to content

Commit 3788cec

Browse files
authored
Removed page status check because it is extremely flakey (#17)
1 parent f2fcb49 commit 3788cec

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

cmd/main.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"syscall"
1515
"time"
1616

17-
"github.com/chromedp/cdproto/network"
1817
"github.com/chromedp/chromedp"
1918
"github.com/nicklaw5/helix/v2"
2019
"github.com/prometheus/client_golang/prometheus/promhttp"
@@ -384,17 +383,6 @@ func streamWebpage(ctx context.Context, config *Config) error {
384383
// Start Chrome and navigate to webpage
385384
logger.Info("Starting Chrome browser", zap.String("url", config.WebpageURL))
386385

387-
// Capture the status code when the page loads
388-
var statusCode int64
389-
chromedp.ListenTarget(chromeCtx, func(ev interface{}) {
390-
switch ev := ev.(type) {
391-
case *network.EventResponseReceived:
392-
if ev.Response.URL == config.WebpageURL {
393-
statusCode = ev.Response.Status
394-
}
395-
}
396-
})
397-
398386
// Load the page
399387
if err := chromedp.Run(chromeCtx,
400388
chromedp.Navigate(config.WebpageURL),
@@ -403,13 +391,6 @@ func streamWebpage(ctx context.Context, config *Config) error {
403391
return fmt.Errorf("failed to navigate to webpage: %v", err)
404392
}
405393

406-
// Log the page load result based on status code
407-
if statusCode >= 200 && statusCode < 300 {
408-
logger.Info("Page load completed successfully", zap.String("url", config.WebpageURL), zap.Int64("status_code", statusCode))
409-
} else {
410-
logger.Fatal("Page load failed with error status, terminating program", zap.String("url", config.WebpageURL), zap.Int64("status_code", statusCode))
411-
}
412-
413394
// Wait a moment for the page to fully load
414395
time.Sleep(3 * time.Second)
415396

0 commit comments

Comments
 (0)