-
Notifications
You must be signed in to change notification settings - Fork 82
Batch debug events sent from injected client to dwds #1487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Batch debug events sent from injected client to dwds #1487
Conversation
Flutter framework sends frequent frame events using `developer.postEvent`. In scenarios where we have to use SSE between the browser and dwds this leads to hign network load and slows down debugging. Batch and send debug events every 1000ms instead. Closes: dart-lang#1466
…tch_requests_extension
dwds/web/batched_stream.dart
Outdated
|
||
var lastSendTime = DateTime.now().millisecondsSinceEpoch; | ||
while (await _inputQueue.hasNext.timeout(duration, onTimeout: () => true)) { | ||
if (await _inputQueue.hasNext.timeout(duration, onTimeout: () => false)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment for this conditional. I'm confused about what the logic here is doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, this is trying not to pause batching until the next element arrives, times it instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made helpers with explanatory names and added comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to adding a few comments in this method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
already done:)
dwds/web/client.dart
Outdated
BatchedStreamController<DebugEvent>(delay: _batchDelayMilliseconds); | ||
debugEventController.stream.listen((events) { | ||
client.sink.add(jsonEncode(serializers.serialize(BatchedDebugEvents( | ||
(b) => b..events = ListBuilder<DebugEvent>(events))))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the .. instead of . ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can remove the extra dot it seems, thanks! The result of the closure parameter in the constructor of BatchedDebugEvents
is not used it appears.
Flutter framework sends frequent frame events using
developer.postEvent
. In scenarios where we have touse SSE between the browser and dwds (possibly on a different machine) this leads to high network load and slows down debugging.
Batch and send debug events every 1000ms instead.
Closes: #1466