tangled
alpha
login
or
join now
ptr.pet
/
nsid-tracker
3
fork
atom
tracks lexicons and how many times they appeared on the jetstream
3
fork
atom
overview
issues
pulls
pipelines
feat(server): time logging to get_hits
ptr.pet
7 months ago
13e6ce8d
f5434e9b
verified
This commit was signed with the committer's
known signature
.
ptr.pet
SSH Key Fingerprint:
SHA256:Abmvag+juovVufZTxyWY8KcVgrznxvBjQpJesv071Aw=
+7
1 changed file
expand all
collapse all
unified
split
server
src
db
mod.rs
+7
server/src/db/mod.rs
···
384
nsid: &str,
385
range: impl RangeBounds<u64> + std::fmt::Debug,
386
) -> impl Iterator<Item = AppResult<handle::Item>> {
0
387
let start_limit = match range.start_bound().cloned() {
388
Bound::Included(start) => start,
389
Bound::Excluded(start) => start.saturating_add(1),
···
399
let Some(handle) = self.get_handle(nsid) else {
400
return Either::Right(std::iter::empty());
401
};
0
402
403
let map_block = move |(key, val)| {
404
let mut key_reader = Cursor::new(key);
···
416
Ok(Some(items))
417
};
418
0
419
Either::Left(
420
handle
421
.range(..end_key)
422
.rev()
0
0
0
0
423
.map_while(move |res| res.map_err(AppError::from).and_then(map_block).transpose())
424
.collect::<Vec<_>>()
425
.into_iter()
···
384
nsid: &str,
385
range: impl RangeBounds<u64> + std::fmt::Debug,
386
) -> impl Iterator<Item = AppResult<handle::Item>> {
387
+
let started_at = CLOCK.now();
388
let start_limit = match range.start_bound().cloned() {
389
Bound::Included(start) => start,
390
Bound::Excluded(start) => start.saturating_add(1),
···
400
let Some(handle) = self.get_handle(nsid) else {
401
return Either::Right(std::iter::empty());
402
};
403
+
tracing::info!("took {}ns to get handle", started_at.elapsed().as_nanos());
404
405
let map_block = move |(key, val)| {
406
let mut key_reader = Cursor::new(key);
···
418
Ok(Some(items))
419
};
420
421
+
let mut ts = CLOCK.now();
422
Either::Left(
423
handle
424
.range(..end_key)
425
.rev()
426
+
.inspect(|_| {
427
+
tracing::info!("took {}ns to get block", ts.elapsed().as_nanos());
428
+
ts = CLOCK.now();
429
+
})
430
.map_while(move |res| res.map_err(AppError::from).and_then(map_block).transpose())
431
.collect::<Vec<_>>()
432
.into_iter()