Commit d88d61b
committed
feat: add switch control when watching events whether deserialization is required
This PR adds an option to disable automatic deserialization in the Watch stream().
By allowing clients to opt-out of automatic deserialization when only basic
JSON parsing is needed, we can significantly reduce time cost and improve
event processing throughput. This is particularly important in scenarios with
high event volumes or resource constraints.
Key changes:
- Added a 'deserialize' parameter to Watch.stream() method (defaults to True for backward compatibility)
- When deserialize=False, events are only JSON parsed without model conversion
- Maintains the original behavior when deserialize=True
- Added test cases to verify both behaviors1 parent 7c22fc1 commit d88d61b
2 files changed
+45
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
182 | 183 | | |
183 | 184 | | |
184 | 185 | | |
185 | 186 | | |
186 | 187 | | |
187 | 188 | | |
188 | 189 | | |
189 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
190 | 195 | | |
191 | 196 | | |
192 | 197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
576 | 576 | | |
577 | 577 | | |
578 | 578 | | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
579 | 618 | | |
580 | 619 | | |
0 commit comments