Skip to content

Conversation

@neelkanth-kaushik
Copy link
Contributor

@neelkanth-kaushik neelkanth-kaushik commented Nov 6, 2025

This pull request introduces proactive size checks on analytics-flutter-queue_flushing_plugin.json file so the SDK avoids queuing events that would push the on-disk queue file above 512 KB. When a new event would exceed the limit, the plugin attempts an immediate flush instead of silently trimming. Keep a safe trimming/fallback path on write failures or unexpected edge cases.

Fixed Github Issue: #186

buffer = utf8.encode(serialized);

// If still too big after trimming to target, write empty queue as last resort
if (buffer.length > _kMaxQueueBytes) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just want double check with @bsneed on this logic to empty the queue. Max individual event size is 32k if I remember correctly which is less than the difference in max size and the 475k target, so this seems ok to me as a probably-never-happen last ditch case.

@neelkanth-kaushik neelkanth-kaushik changed the title Prevent JSON queue file growth over 512 KB Fix for Issue #186: Prevent JSON queue file growth over 512 KB Nov 18, 2025
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.

3 participants