public Task JoinGroup(string crypto, string currency) { var groupName = GetKey(crypto, currency); _connectionGroupStorage.Lock(); _connectionGroupStorage.Store(Context.ConnectionId, groupName); _connectionGroupStorage.Release(); return(base.Groups.AddToGroupAsync(Context.ConnectionId, groupName)); }
private void CheckNotUsedTasks() { while (!_isDisposing) { Thread.Sleep(PoolingTimeInMilliseconds); var taskKeys = _priceTaskStorage.GetTaskKeys().ToArray(); if (taskKeys.Any()) { _connectionGroupStorage.Lock(); foreach (var taskKey in taskKeys) { if (_connectionGroupStorage.IsEmpty(taskKey)) { CancelTask(taskKey); } } _connectionGroupStorage.Release(); } } }