Skip to content

fix: reduce chrome API calls to prevent slowness with DLP extensions - #7

Merged
justcarlson merged 2 commits into
masterfrom
fix/dlp-extension-slowness
Jan 27, 2026
Merged

justcarlson merged 2 commits into
masterfrom
fix/dlp-extension-slowness

Conversation

@justcarlson

Copy link
Copy Markdown
Owner

Summary

  • Fix extension slowness when DLP extensions (like Incydr) are active
  • Parallelize setActionIcon() for mode changes
  • Add setTabIcon() for single-tab updates on navigation events
  • Reduce API calls from O(N) to O(1) per navigation

Problem

DLP/security extensions add latency to each chrome.* API call. Previously, every tab navigation triggered N+1 API calls (1 query + N icon updates), causing compounding delays.

Solution

  • Only update the specific tab that navigated, not all tabs
  • Use parallel Promise.all() when updating all tabs is needed (mode changes)

Test plan

  • All 95 unit tests pass
  • Extension builds successfully
  • Lint passes

Changed setActionIcon() from sequential await in a for loop to
Promise.all() with parallel execution. Previously, each
chrome.action.setIcon() call blocked until completion before the next
started - with N tabs, this took N * (single call time). Now all icon
updates run in parallel.

Root cause: Sequential await in for loop blocked service worker
Debug session: .planning/debug/resolved/extension-slowness.md
When DLP extensions like Incydr monitor chrome.* API calls, each call
adds latency. The previous setActionIcon() queried all tabs and updated
all icons on every DOMContentLoaded event - O(N) API calls for O(1) change.

This fix:
- Adds setTabIcon() for single-tab updates (O(1) API calls)
- Renames setActionIcon() to setAllTabIcons() for mode changes only
- Changes onDOMContentLoaded to update only the current tab's icon

With 5 Zendesk tabs and 50ms DLP latency per call:
- Before: ~300ms per navigation (6 calls)
- After: ~50ms per navigation (1 call)

Root cause: O(N) chrome.* API calls per event amplified by DLP monitoring
Debug session: .planning/debug/resolved/extension-slowness-incydr.md
@justcarlson
justcarlson merged commit 313e5b5 into master Jan 27, 2026
3 checks passed
@justcarlson
justcarlson deleted the fix/dlp-extension-slowness branch January 27, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant