High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
fix formatting issues in state.go
bot3f87b05404a8
diff --git a/state.go b/state.goindex 563fe9c6..9a12870e 100644--- a/state.go+++ b/state.go@@ -101,10 +101,10 @@ func (b *Bridge) RestoreState() {// Limit concurrent tab creation to avoid overwhelming Chromeconst maxConcurrentTabs = 3const maxConcurrentNavs = 2-+tabSem := make(chan struct{}, maxConcurrentTabs)navSem := make(chan struct{}, maxConcurrentNavs)-+restored := 0for _, tab := range state.Tabs {if strings.Contains(tab.URL, "/sorry/") || strings.Contains(tab.URL, "about:blank") {@@ -113,7 +113,7 @@ func (b *Bridge) RestoreState() {// Acquire semaphore for tab creationtabSem <- struct{}{}-+// Small delay between tab creations to spread loadif restored > 0 {time.Sleep(200 * time.Millisecond)@@ -127,7 +127,7 @@ func (b *Bridge) RestoreState() {slog.Warn("restore tab failed", "url", tab.URL, "err", err)continue}-+newID := string(chromedp.FromContext(ctx).Target.TargetID)b.mu.Lock()b.tabs[newID] = &TabEntry{ctx: ctx, cancel: cancel}@@ -137,11 +137,11 @@ func (b *Bridge) RestoreState() {// Fire-and-forget navigate with concurrency limitinggo func(tabCtx context.Context, url string) {defer func() { <-tabSem }() // Release tab semaphore when done-+// Acquire navigation semaphorenavSem <- struct{}{}defer func() { <-navSem }()-+tCtx, tCancel := context.WithTimeout(tabCtx, 15*time.Second)defer tCancel()_ = chromedp.Run(tCtx, chromedp.ActionFunc(func(ctx context.Context) error {