Files: removed temp

This commit is contained in:
pavelbannov 2021-01-13 12:41:29 +03:00
parent 60562d69a3
commit ae69a9559e
23 changed files with 36 additions and 44 deletions

3
build/Jenkinsfile vendored
View File

@ -2,7 +2,6 @@ pipeline {
agent none
stages {
stage('Build') {
when { expression { return false; } }
parallel {
stage('Unix') {
agent { label 'net-core' }
@ -63,7 +62,6 @@ pipeline {
agent { label 'net-core' }
stages {
stage('Components') {
when { expression { return false; } }
steps {
sh "sh ./build/scripts/components.sh && cd ${env.WORKSPACE}/web/ASC.Web.Components && yarn test:coverage --ci --reporters=default --reporters=jest-junit || true"
}
@ -93,7 +91,6 @@ pipeline {
agent { label 'win-core' }
stages {
stage('Components') {
when { expression { return false; } }
steps {
bat "sh build\\scripts\\components.sh && cd ${env.WORKSPACE}\\web\\ASC.Web.Components && yarn test:coverage --ci --reporters=default --reporters=jest-junit || true"
}

View File

@ -67,7 +67,7 @@ namespace ASC.Common.Caching
[Singletone]
public class AscCache : ICache
{
public IMemoryCache MemoryCache { get; }
private IMemoryCache MemoryCache { get; }
public AscCache(IMemoryCache memoryCache)
{

View File

@ -34,8 +34,6 @@ using System.Threading.Tasks;
using ASC.Common.Caching;
using NUnit.Framework;
namespace ASC.Common.Threading
{
[Singletone]
@ -69,13 +67,11 @@ namespace ASC.Common.Threading
notifyCache.Subscribe((c) =>
{
TestContext.WriteLine($"HashSet remove key: {c}");
Cache.HashSet(c.Key, c.Id, (DistributedTaskCache)null);
}, CacheNotifyAction.Remove);
notifyCache.Subscribe((c) =>
{
TestContext.WriteLine($"HashSet key: {c}");
Cache.HashSet(c.Key, c.Id, c);
}, CacheNotifyAction.InsertOrUpdate);
}
@ -146,14 +142,9 @@ namespace ASC.Common.Threading
var cancelation = new CancellationTokenSource();
var token = cancelation.Token;
cancelations[distributedTask.Id] = cancelation;
TestContext.WriteLine($"ThreadId QueueTask: {Thread.CurrentThread.ManagedThreadId}");
cancelations[distributedTask.Id] = cancelation;
var task = new Task(() => {
TestContext.WriteLine($"ThreadId QueueTask task: {Thread.CurrentThread.ManagedThreadId}");
action(distributedTask, token);
}, token, TaskCreationOptions.LongRunning);
var task = new Task(() => { action(distributedTask, token); }, token, TaskCreationOptions.LongRunning);
task
.ConfigureAwait(false)
.GetAwaiter()
@ -172,7 +163,6 @@ namespace ASC.Common.Threading
public IEnumerable<DistributedTask> GetTasks()
{
TestContext.WriteLine($"key: {key}");
var tasks = cache.HashGetAll<DistributedTaskCache>(key).Select(r => new DistributedTask(r.Value)).ToList();
tasks.ForEach(t =>
{

View File

@ -49,7 +49,7 @@ namespace ASC.Core.Caching
public const string REFS = "refs";
public TrustInterval TrustInterval { get; set; }
public ICache Cache { get; }
internal ICache Cache { get; }
internal CoreBaseSettings CoreBaseSettings { get; }
internal ICacheNotify<UserInfoCacheItem> CacheUserInfoItem { get; }
internal ICacheNotify<UserPhotoCacheItem> CacheUserPhotoItem { get; }

View File

@ -36,9 +36,9 @@ namespace ASC.Data.Storage.Migration
[Singletone]
public class ServiceClientListener
{
public ICacheNotify<MigrationProgress> ProgressMigrationNotify { get; }
public IServiceProvider ServiceProvider { get; }
public ICache Cache { get; }
private ICacheNotify<MigrationProgress> ProgressMigrationNotify { get; }
private IServiceProvider ServiceProvider { get; }
private ICache Cache { get; }
public ServiceClientListener(
ICacheNotify<MigrationProgress> progressMigrationNotify,

View File

@ -43,7 +43,7 @@ namespace ASC.VoipService.Dao
[Singletone]
public class VoipDaoCache
{
public ICache Cache { get; }
internal ICache Cache { get; }
private ICacheNotify<CachedVoipItem> Notify { get; }
public VoipDaoCache(ICacheNotify<CachedVoipItem> notify, ICache cache)

View File

@ -61,6 +61,7 @@ namespace ASC.ApiSystem
var diHelper = new DIHelper(services);
services.AddHttpContextAccessor();
services.AddMemoryCache();
services.AddControllers()
.AddJsonOptions(options =>

View File

@ -49,7 +49,7 @@ namespace ASC.Data.Backup.Service
public class BackupServiceNotifier
{
private ICacheNotify<BackupProgress> СacheBackupProgress { get; }
public ICache Cache { get; }
private ICache Cache { get; }
public BackupServiceNotifier(ICacheNotify<BackupProgress> сacheBackupProgress, ICache cache)
{

View File

@ -44,9 +44,9 @@ namespace ASC.Data.Storage.Encryption
private object Locker { get; }
private FactoryOperation FactoryOperation { get; }
public EncryptionWorker(FactoryOperation factoryOperation)
public EncryptionWorker(FactoryOperation factoryOperation, ICache cache)
{
Cache = AscCache.Memory;
Cache = cache;
Locker = new object();
FactoryOperation = factoryOperation;
}

View File

@ -49,9 +49,9 @@ namespace ASC.Data.Storage.Migration
);
})
.ConfigureServices((hostContext, services) =>
{
{
services.AddMemoryCache();
var diHelper = new DIHelper(services);
LogNLogExtension.ConfigureLog(diHelper, "ASC.Data.Storage.Migration", "ASC.Migration");
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>));

View File

@ -91,7 +91,7 @@ namespace ASC.ElasticSearch
private IServiceProvider ServiceProvider { get; }
public string IndexName { get => Indexer.IndexName; }
public ICache Cache { get; }
private ICache Cache { get; }
public virtual string SettingsTitle { get => ""; }
public FactoryIndexer(

View File

@ -52,6 +52,7 @@ namespace ASC.Notify
})
.ConfigureServices((hostContext, services) =>
{
services.AddMemoryCache();
var diHelper = new DIHelper(services);
LogNLogExtension.ConfigureLog(diHelper, "ASC.Notify", "ASC.Notify.Messages");

View File

@ -76,7 +76,8 @@ namespace ASC.Socket.IO.Svc
);
})
.ConfigureServices((hostContext, services) =>
{
{
services.AddMemoryCache();
var diHelper = new DIHelper(services);
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>));
LogNLogExtension.ConfigureLog(diHelper, "ASC.Socket.IO.Svc");

View File

@ -53,6 +53,7 @@ namespace ASC.Studio.Notify
})
.ConfigureServices((hostContext, services) =>
{
services.AddMemoryCache();
var diHelper = new DIHelper(services);
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>));
LogNLogExtension.ConfigureLog(diHelper, "ASC.Notify", "ASC.Notify.Messages");

View File

@ -76,7 +76,8 @@ namespace ASC.Thumbnails.Svc
);
})
.ConfigureServices((hostContext, services) =>
{
{
services.AddMemoryCache();
var diHelper = new DIHelper(services);
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>));

View File

@ -74,7 +74,8 @@ namespace ASC.UrlShortener.Svc
);
})
.ConfigureServices((hostContext, services) =>
{
{
services.AddMemoryCache();
var diHelper = new DIHelper(services);
LogNLogExtension.ConfigureLog(diHelper, "ASC.UrlShortener.Svc");
services.AddHostedService<UrlShortenerServiceLauncher>();

View File

@ -37,8 +37,6 @@ using ASC.Files.Core.Resources;
using Microsoft.Extensions.Primitives;
using NUnit.Framework;
namespace ASC.Web.Files.Services.WCFService.FileOperations
{
[Singletone(Additional = typeof(FileOperationsManagerHelperExtention))]
@ -57,8 +55,7 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
public ItemList<FileOperationResult> GetOperationResults(Guid userId)
{
var operations = tasks.GetTasks();
var processlist = Process.GetProcesses();
TestContext.WriteLine($"operations.Any: {operations.Any()}");
var processlist = Process.GetProcesses();
//TODO: replace with distributed cache
if (processlist.Any())
@ -77,7 +74,6 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
tasks.RemoveTask(o.Id);
}
TestContext.WriteLine($"operations1.Any: {operations.Any()}");
var results = operations
.Where(o => o.GetProperty<bool>(FileOperation.HOLD) || o.GetProperty<int>(FileOperation.PROGRESS) != 100)
.Select(o => new FileOperationResult
@ -163,8 +159,7 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations
private ItemList<FileOperationResult> QueueTask(Guid userId, FileOperation op)
{
tasks.QueueTask(op.RunJob, op.GetDistributedTask());
TestContext.WriteLine($"tasks.Any: {tasks.GetTasks().Any()}");
tasks.QueueTask(op.RunJob, op.GetDistributedTask());
return GetOperationResults(userId);
}

View File

@ -53,6 +53,8 @@ namespace ASC.Files.Service
})
.ConfigureServices((hostContext, services) =>
{
services.AddMemoryCache();
var diHelper = new DIHelper(services);
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>));

View File

@ -281,10 +281,12 @@ namespace ASC.Files.Tests
while (true)
{
statuses = FileStorageService.GetTasksStatuses();
TestContext.WriteLine($"statuses.Any: {statuses.Any()}");
if (statuses.TrueForAll(r => r.Finished))
break;
{
break;
}
await Task.Delay(100);
}

View File

@ -79,7 +79,7 @@ namespace ASC.Web.Core.Mail
public MailServiceHelperStorage MailServiceHelperStorage { get; }
private EFLoggerFactory LoggerFactory { get; }
private MailDbContext MailDbContext { get; }
public ICache Cache { get; }
private ICache Cache { get; }
public MailServiceHelper(
UserManager userManager,

View File

@ -62,8 +62,8 @@ namespace ASC.Web.Core.Sms
public readonly TimeSpan StoreInterval;
public readonly int AttemptCount;
private static readonly object KeyLocker = new object();
public ICache KeyCache { get; }
public ICache CheckCache { get; }
private ICache KeyCache { get; }
private ICache CheckCache { get; }
private TenantManager TenantManager { get; }
public SmsKeyStorageCache SmsKeyStorageCache { get; }

View File

@ -45,7 +45,7 @@ namespace ASC.Web.Core
[Singletone]
public class WebItemSecurityCache
{
public ICache Cache { get; }
private ICache Cache { get; }
private ICacheNotify<WebItemSecurityNotifier> CacheNotify { get; }
public WebItemSecurityCache(ICacheNotify<WebItemSecurityNotifier> cacheNotify, ICache cache)

View File

@ -52,7 +52,7 @@ namespace ASC.Web.Core.WhiteLabel
private set;
}
public ICache Cache { get; }
private ICache Cache { get; }
private ICacheNotify<TenantLogoCacheItem> CacheNotify { get; }
public TenantLogoManager(