alpha
Login
or
Join now
microcosm.blue
/
microcosm-rs
Star
0
Fork
3
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm
Star
0
Fork
3
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
json from reader
author
phil
date
1 year ago
(Apr 2, 2025, 3:42 PM -0400)
commit
e52504bb
e52504bbf53aa9c9bd3e492d6c4323cb65a6689f
parent
c5e0dbdb
c5e0dbdbaf9e60960483697fe051dd80407f2c84
+4
-14
1 changed file
Expand all
Collapse all
Unified
Split
jetstream
src
lib.rs
+4
-14
jetstream/src/lib.rs
Reviewed
···
3
3
pub mod exports;
4
4
5
5
use std::{
6
6
-
io::{
7
7
-
Cursor as IoCursor,
8
8
-
Read,
9
9
-
},
6
6
+
io::Cursor as IoCursor,
10
7
time::{
11
8
Duration,
12
9
Instant,
···
453
450
}
454
451
Message::Binary(zstd_json) => {
455
452
let mut cursor = IoCursor::new(zstd_json);
456
456
-
let mut decoder = zstd::stream::Decoder::with_prepared_dictionary(
453
453
+
let decoder = zstd::stream::Decoder::with_prepared_dictionary(
457
454
&mut cursor,
458
455
&dictionary,
459
456
)
460
457
.map_err(JetstreamEventError::CompressionDictionaryError)?;
461
458
462
462
-
let mut json = String::new();
463
463
-
decoder
464
464
-
.read_to_string(&mut json)
465
465
-
.map_err(JetstreamEventError::CompressionDecoderError)?;
466
466
-
467
467
-
let event: JetstreamEvent = serde_json::from_str(&json).map_err(|e| {
468
468
-
eprintln!("lkasjdflkajsd {e:?} {json}");
469
469
-
JetstreamEventError::ReceivedMalformedJSON(e)
470
470
-
})?;
459
459
+
let event: JetstreamEvent = serde_json::from_reader(decoder)
460
460
+
.map_err(JetstreamEventError::ReceivedMalformedJSON)?;
471
461
let event_cursor = event.cursor.clone();
472
462
473
463
if let Some(last) = last_cursor {