commit
ef618f534e
@ -80,7 +80,7 @@ public class FileMarker
|
||||
private readonly AuthContext _authContext;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly FilesSettingsHelper _filesSettingsHelper;
|
||||
|
||||
private static readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1);
|
||||
public FileMarker(
|
||||
TenantManager tenantManager,
|
||||
UserManager userManager,
|
||||
@ -352,6 +352,10 @@ public class FileMarker
|
||||
var newTags = new List<Tag>();
|
||||
var updateTags = new List<Tag>();
|
||||
|
||||
try
|
||||
{
|
||||
await _semaphore.WaitAsync();
|
||||
|
||||
foreach (var userID in userEntriesData.Keys)
|
||||
{
|
||||
if (await tagDao.GetNewTagsAsync(userID, obj.FileEntry).AnyAsync())
|
||||
@ -365,8 +369,6 @@ public class FileMarker
|
||||
await GetNewTagsAsync(userID, entries.OfType<FileEntry<string>>().ToList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (updateTags.Count > 0)
|
||||
{
|
||||
await tagDao.UpdateNewTags(updateTags, obj.CurrentAccountId);
|
||||
@ -376,6 +378,15 @@ public class FileMarker
|
||||
{
|
||||
await tagDao.SaveTags(newTags, obj.CurrentAccountId);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_semaphore.Release();
|
||||
}
|
||||
|
||||
await Task.WhenAll(ExecMarkAsNewRequest(updateTags.Concat(newTags), socketManager));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user