mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
refactor(web): use max for the settle budget
This commit is contained in:
1 parent
b7d3b1b7cb
commit
83285f0c30
1 file changed
+1
-4
@@ -548,10 +548,7 @@ func (d *Driver) WaitForIdle(ctx context.Context, timeout time.Duration) error {
|
||||
defer cancel()
|
||||
// Leave the caller's deadline some room: returning late by our own doing
|
||||
// would surface as a context cancellation instead of a settled page.
|
||||
budget := timeout - 100*time.Millisecond
|
||||
if budget < domQuietPeriod {
|
||||
budget = domQuietPeriod
|
||||
}
|
||||
budget := max(timeout-100*time.Millisecond, domQuietPeriod)
|
||||
script := fmt.Sprintf(settleScript, domQuietPeriod.Milliseconds(), budget.Milliseconds())
|
||||
return chromedp.Run(runCtx,
|
||||
chromedp.WaitReady("body", chromedp.ByQuery),
|
||||
|
||||
Reference in new issue
Block a user