[backend/core] Update user record with updated lastFetchedAt property in UserResolver.GetUpdatedUser
This commit is contained in:
parent
5c5370bd1a
commit
d5ce61d901
1 changed files with 6 additions and 1 deletions
|
@ -5,6 +5,7 @@ using Iceshrimp.Backend.Core.Database.Tables;
|
||||||
using Iceshrimp.Backend.Core.Federation.WebFinger;
|
using Iceshrimp.Backend.Core.Federation.WebFinger;
|
||||||
using Iceshrimp.Backend.Core.Middleware;
|
using Iceshrimp.Backend.Core.Middleware;
|
||||||
using Iceshrimp.Backend.Core.Services;
|
using Iceshrimp.Backend.Core.Services;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
namespace Iceshrimp.Backend.Core.Federation.ActivityPub;
|
namespace Iceshrimp.Backend.Core.Federation.ActivityPub;
|
||||||
|
@ -288,7 +289,11 @@ public class UserResolver(
|
||||||
public async Task<User> GetUpdatedUser(User user)
|
public async Task<User> GetUpdatedUser(User user)
|
||||||
{
|
{
|
||||||
if (!user.NeedsUpdate) return user;
|
if (!user.NeedsUpdate) return user;
|
||||||
user.LastFetchedAt = DateTime.UtcNow; // Prevent multiple background tasks from being started
|
|
||||||
|
// Prevent multiple background tasks from being started
|
||||||
|
user.LastFetchedAt = DateTime.UtcNow;
|
||||||
|
await db.Users.Where(p => p == user)
|
||||||
|
.ExecuteUpdateAsync(p => p.SetProperty(i => i.LastFetchedAt, _ => user.LastFetchedAt));
|
||||||
|
|
||||||
var success = false;
|
var success = false;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue