[backend/masto-client] Use Task.WhenAll in timeline controller methods
This commit is contained in:
parent
a3fd46bb96
commit
519b5280ac
1 changed files with 6 additions and 4 deletions
|
@ -33,7 +33,8 @@ public class MastodonTimelineController(DatabaseContext db, NoteRenderer noteRen
|
||||||
.Take(40)
|
.Take(40)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
return Ok(notes.Select(async p => await noteRenderer.RenderAsync(p)));
|
var res = await Task.WhenAll(notes.Select(async p => await noteRenderer.RenderAsync(p)));
|
||||||
|
return Ok(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
[AuthorizeOauth("read:statuses")]
|
[AuthorizeOauth("read:statuses")]
|
||||||
|
@ -48,6 +49,7 @@ public class MastodonTimelineController(DatabaseContext db, NoteRenderer noteRen
|
||||||
.Take(40)
|
.Take(40)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
return Ok(notes.Select(async p => await noteRenderer.RenderAsync(p)));
|
var res = await Task.WhenAll(notes.Select(async p => await noteRenderer.RenderAsync(p)));
|
||||||
|
return Ok(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue