mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-23 11:21:32 +00:00
Fetch community outbox and moderators in parallel (#3360)
This will speedup first time fetching of a remote community
This commit is contained in:
parent
8fbc630ce1
commit
50efb1d519
1 changed files with 8 additions and 11 deletions
|
@ -140,19 +140,16 @@ impl Object for ApubCommunity {
|
||||||
|
|
||||||
// Fetching mods and outbox is not necessary for Lemmy to work, so ignore errors. Besides,
|
// Fetching mods and outbox is not necessary for Lemmy to work, so ignore errors. Besides,
|
||||||
// we need to ignore these errors so that tests can work entirely offline.
|
// we need to ignore these errors so that tests can work entirely offline.
|
||||||
group
|
let fetch_outbox = group.outbox.dereference(&community, context);
|
||||||
.outbox
|
|
||||||
.dereference(&community, context)
|
|
||||||
.await
|
|
||||||
.map_err(|e| debug!("{}", e))
|
|
||||||
.ok();
|
|
||||||
|
|
||||||
if let Some(moderators) = group.attributed_to {
|
if let Some(moderators) = group.attributed_to {
|
||||||
moderators
|
let fetch_moderators = moderators.dereference(&community, context);
|
||||||
.dereference(&community, context)
|
// Fetch mods and outbox in parallel
|
||||||
.await
|
let res = tokio::join!(fetch_outbox, fetch_moderators);
|
||||||
.map_err(|e| debug!("{}", e))
|
res.0.map_err(|e| debug!("{}", e)).ok();
|
||||||
.ok();
|
res.1.map_err(|e| debug!("{}", e)).ok();
|
||||||
|
} else {
|
||||||
|
fetch_outbox.await.map_err(|e| debug!("{}", e)).ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(community)
|
Ok(community)
|
||||||
|
|
Loading…
Reference in a new issue