Merge pull request #1223 from ONLYOFFICE/bugfix/60994

fix Bug 60994
This commit is contained in:
Pavel Bannov 2023-02-22 13:02:07 +03:00 committed by GitHub
commit ef618f534e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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));