Fix #2282: Add adaptive polling with exponential backoff for LiveUpdate#2423
Merged
anshu10sep merged 1 commit intomainfrom Apr 16, 2026
Merged
Fix #2282: Add adaptive polling with exponential backoff for LiveUpdate#2423anshu10sep merged 1 commit intomainfrom
anshu10sep merged 1 commit intomainfrom
Conversation
LiveUpdate previously polled Figma every 5 seconds unconditionally,
which triggered rate limiting ('Too many requests') during long
sessions.
This change implements exponential backoff for the polling interval:
- After each consecutive unchanged response, the interval doubles
(5s → 10s → 20s → 40s → 60s max)
- When a document change is detected, the interval resets to 5s
- When live updates are explicitly started (resume, toggle),
the interval resets to 5s
This significantly reduces API calls during idle editing periods
while still providing responsive updates when the designer is
actively making changes.
Interval progression:
Change 0: 5s (base)
No change 1: 10s
No change 2: 20s
No change 3: 40s
No change 4+: 60s (max)
Document changes: → 5s (reset)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2423 +/- ##
============================================
- Coverage 44.05% 44.03% -0.03%
Complexity 19 19
============================================
Files 39 39
Lines 4444 4444
Branches 51 51
============================================
- Hits 1958 1957 -1
- Misses 2472 2473 +1
Partials 14 14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Snapshot diff report vs base branch: main |
dipenpradhan
approved these changes
Apr 16, 2026
| // unchanged responses. The interval increases exponentially (5s -> 10s -> 20s -> 40s -> 60s) | ||
| // when no changes are detected, and resets to FETCH_INTERVAL_MILLIS when a document changes. | ||
| // This reduces Figma API calls and avoids rate limiting. (Issue #2282) | ||
| internal var currentFetchIntervalMillis: Long = FETCH_INTERVAL_MILLIS |
Collaborator
There was a problem hiding this comment.
We need to add this into the Jekyll docs and README, updating #2379 to add the documentation and switch to this variable currentFetchIntervalMillis,
This was referenced Apr 22, 2026
Merged
dipenpradhan
added a commit
that referenced
this pull request
Apr 22, 2026
Create v0.39.0-RC02 v0.39.0-RC01(#2446) This commit bumps the version across all Gradle (`gradle/libs.versions.toml`) and Cargo configuration files to `0.39.0` (`0.39.0-SNAPSHOT` in Gradle). It also unifies the `dc_squoosh_animation` and `dc_squoosh_parser` crates under the workspace dependencies. Changes and issues addressed since 0.38.4: - Enhance LiveUpdate feature (Issues #2282, #2379) - Add cargo publish steps to GitHub release workflow (Issues #2435, #2436) - Squoosh Designer Plugin: Figma plugin for orchestrating layout animations (Issue #2402) - Replace println!/eprintln! with Rust log API in library code (Issues #2403, #2411) - Update dc_figma_import README to reflect current architecture (Issues #426, #2427) - Add comprehensive unit tests for mergeStyles function (Issues #1963, #2416) - Avoid double key events during animated transitions (Issues #1514, #2417) - Clean up unwrap() calls in dc_jni crate (Issues #670, #2415) - Security: Update rustls-webpki 0.103.10 -> 0.103.12 (Issue #2434) - Document supported Android SDK levels (Issues #163, #2429) - Restore Modifier customization support in squoosh renderer (Issues #2292, #2426) - Handle unknown Figma features in deserialization (Issues #2305, #2414) - Add adaptive polling with exponential backoff for LiveUpdate (Issues #2282, #2423) - Add comprehensive Rust layout unit tests (Issues #405, #2413) - Update JNI dependency to 0.22.4 and refactor dc_jni (Issue #2432) - Enable CodeQL security scanning (Issues #926, #2412) - Prevent Design Switcher from briefly showing 'Offline' (Issues #142, #2421) - Stroke gradients account for stroke thickness (Issues #1549, #2420) - Add performance logging for high-cost fetch operations (Issues #281, #2419) - Remove unclaimed Open VSX extension recommendation (Issue #2431) - Add assembleRelease to CI to catch minified build issues (Issues #435, #2425) - Deprecate and remove publish_designcompose.sh script (Issue #2433) - Clarify visibility documentation — parameter name is flexible (Issues #660, #2428) - Add JDK installation instructions to Getting Started docs (Issues #707, #2424) - Add security check for Figma token file permissions (Issues #249, #2418) - Fix whilePressing interaction getting stuck on multi-touch drag (Issue #2422) - Fix SquooshRoot infinite recomposition and freeze on rapid tap (Issue #2409) - Fix #436: Tutorial release build signing configuration (#2437) - Fix #291: Progress marker alignment in nested instances (#2444) - Fix #244: Rotated node margin calculation uses pre-rotation size (#2439) --------- Co-authored-by: anshu10sep <priyanksingh@google.com>
kovmarci86
pushed a commit
to kovmarci86/automotive-design-compose
that referenced
this pull request
Apr 22, 2026
This commit bumps the version across all Gradle (`gradle/libs.versions.toml`) and Cargo configuration files to `0.39.0` (`0.39.0-SNAPSHOT` in Gradle). It also unifies the `dc_squoosh_animation` and `dc_squoosh_parser` crates under the workspace dependencies. Changes and issues addressed since 0.38.4: - Enhance LiveUpdate feature (Issues google#2282, google#2379) - Add cargo publish steps to GitHub release workflow (Issues google#2435, google#2436) - Squoosh Designer Plugin: Figma plugin for orchestrating layout animations (Issue google#2402) - Replace println!/eprintln! with Rust log API in library code (Issues google#2403, google#2411) - Update dc_figma_import README to reflect current architecture (Issues google#426, google#2427) - Add comprehensive unit tests for mergeStyles function (Issues google#1963, google#2416) - Avoid double key events during animated transitions (Issues google#1514, google#2417) - Clean up unwrap() calls in dc_jni crate (Issues google#670, google#2415) - Security: Update rustls-webpki 0.103.10 -> 0.103.12 (Issue google#2434) - Document supported Android SDK levels (Issues google#163, google#2429) - Restore Modifier customization support in squoosh renderer (Issues google#2292, google#2426) - Handle unknown Figma features in deserialization (Issues google#2305, google#2414) - Add adaptive polling with exponential backoff for LiveUpdate (Issues google#2282, google#2423) - Add comprehensive Rust layout unit tests (Issues google#405, google#2413) - Update JNI dependency to 0.22.4 and refactor dc_jni (Issue google#2432) - Enable CodeQL security scanning (Issues google#926, google#2412) - Prevent Design Switcher from briefly showing 'Offline' (Issues google#142, google#2421) - Stroke gradients account for stroke thickness (Issues google#1549, google#2420) - Add performance logging for high-cost fetch operations (Issues google#281, google#2419) - Remove unclaimed Open VSX extension recommendation (Issue google#2431) - Add assembleRelease to CI to catch minified build issues (Issues google#435, google#2425) - Deprecate and remove publish_designcompose.sh script (Issue google#2433) - Clarify visibility documentation — parameter name is flexible (Issues google#660, google#2428) - Add JDK installation instructions to Getting Started docs (Issues google#707, google#2424) - Add security check for Figma token file permissions (Issues google#249, google#2418) - Fix whilePressing interaction getting stuck on multi-touch drag (Issue google#2422) - Fix SquooshRoot infinite recomposition and freeze on rapid tap (Issue google#2409)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements exponential backoff for LiveUpdate polling to prevent Figma rate limiting during long sessions.
Problem
LiveUpdate polls Figma every 5 seconds unconditionally. During long development sessions with no active Figma changes, this exhausts the Figma API rate limit, resulting in 'Too many requests to Figma.com' errors.
This was exacerbated by Figma's introduction of rate limits in November 2025.
Solution
Adaptive polling with exponential backoff:
When a document change is detected, the interval resets to 5s immediately. The interval also resets when live updates are explicitly restarted (activity resume, toggle).
Changes
DocServer.kt:MAX_FETCH_INTERVAL_MILLIS(60s),currentFetchIntervalMillis, andconsecutiveUnchangedCountfieldsscheduleLiveUpdate()usescurrentFetchIntervalMillisinstead of hardcoded intervalstartLiveUpdates()resets interval and counter on explicit startfetchDocuments()increments/resets backoff based on whether document changedValidation
./gradlew designcompose:compileDebugKotlin: ✅./gradlew spotCheck: ✅1L shl n) capped to 4 shifts max, ensuring interval never exceeds 60sFixes #2282