Skip to content

Conversation

@takaokouji
Copy link

This PR implements batch event sending for Mesh v2 to reduce AWS AppSync Subscription costs and preserve event timing.

Key changes:

  • Added an event queue and batch sending logic that triggers every 250ms.
  • Implemented the 'fireEventsByNode' mutation for batch delivery.
  • Added 'onBatchEventInGroup' subscription handling to reproduce original event timing using timestamp offsets.
  • Implemented automatic splitting of large batches (over 1,000 events) to respect AppSync payload limits.
  • Added comprehensive integration tests covering timing reproduction and batch splitting.

Related Issue: smalruby/smalruby3-gui#473

- Added event queue and batch sending logic every 250ms
- Implemented fireEventsByNode mutation for batch delivery
- Added onBatchEventInGroup subscription handling
- Preserves event timing by using relative offsets from timestamps
- Splits large batches (over 1000 events) to respect AppSync payload limits
- Optimized RSSI calculation tests to be independent of environment variables

GitHub Issue: scratchfoundation#473
- Verify timing reproduction of batched events
- Verify splitting of large batches (over 1000 events)
- Completes testing requirements for Issue scratchfoundation#473
- Change MIN_INTERVAL from 1 to 17 in handleBatchEvent to ensure
  events are spaced out by at least one frame.
- Add detailed debug logs with original timestamps.
- Fix lint errors (max-len) in mesh-service.js, scratch3_event.js,
  and runtime.js.

Issue: scratchfoundation#473
@takaokouji takaokouji merged commit c5a5d82 into develop Dec 29, 2025
1 check passed
@takaokouji takaokouji deleted the feature/473-batch-event-sending branch December 29, 2025 23:29
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.

2 participants