Exemple #1
0
        private async Task <IEnumerable <string> > GetAllSubscribersAsync(string topic, PublishOptions options)
        {
            var offset = options.Offset;

            var getSubscribersResult = await this.GetSubscribersAsync(topic, options);

            var subscribers         = getSubscribersResult.Subscribers;
            var subscribersInTxPool = getSubscribersResult.SubscribersInTxPool;

            var walletOptions = options.Clone();

            while (getSubscribersResult.Subscribers != null && getSubscribersResult.Subscribers.Count() >= options.Limit)
            {
                offset += options.Limit;

                walletOptions.Offset = offset;
                walletOptions.TxPool = false;

                getSubscribersResult = await this.GetSubscribersAsync(topic, walletOptions);

                if (getSubscribersResult.Subscribers != null)
                {
                    subscribers = subscribers.Concat(getSubscribersResult.Subscribers);
                }
            }

            if (options.TxPool == true && subscribersInTxPool != null)
            {
                subscribers = subscribers.Concat(subscribersInTxPool);
            }

            return(subscribers);
        }