Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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();
                }
            }
        }