[backend/core] Remove userPrivateKey cache in deliver queue
There's no performance difference between fetching just the private key from the user_keypair table and the previous caching implementation, so there's no point in keeping it in the cache.
This commit is contained in:
parent
7627219322
commit
dea43be619
1 changed files with 7 additions and 9 deletions
|
@ -33,16 +33,14 @@ public class DeliverQueue(int parallelism)
|
|||
|
||||
logger.LogDebug("Delivering activity to: {uri}", jobData.InboxUrl);
|
||||
|
||||
var key = await cache.FetchAsync($"userPrivateKey:{jobData.UserId}", TimeSpan.FromMinutes(60), async () =>
|
||||
{
|
||||
var keypair =
|
||||
await db.UserKeypairs.FirstOrDefaultAsync(p => p.UserId == jobData.UserId, token);
|
||||
return keypair?.PrivateKey ?? throw new Exception($"Failed to get keypair for user {jobData.UserId}");
|
||||
});
|
||||
var key = await db.UserKeypairs
|
||||
.Where(p => p.UserId == jobData.UserId)
|
||||
.Select(p => p.PrivateKey)
|
||||
.FirstOrDefaultAsync(token) ??
|
||||
throw new Exception($"Failed to get keypair for user {jobData.UserId}");
|
||||
|
||||
var request =
|
||||
await httpRqSvc.PostSignedAsync(jobData.InboxUrl, jobData.Payload, jobData.ContentType, jobData.UserId,
|
||||
key);
|
||||
var request = await httpRqSvc.PostSignedAsync(jobData.InboxUrl, jobData.Payload, jobData.ContentType,
|
||||
jobData.UserId, key);
|
||||
|
||||
try
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue