Exemple #1
0
        public async Task <IEnumerable <Chapter> > GetChapters(string manga, IProgress <string> progress, CancellationToken cancellationToken)
        {
            Logger.Info($@"> FindChapters(): {manga}");
            IEnumerable <Chapter> chaps = await retry.DoAsync(() =>
            {
                return(DownloadAndParseChapters(manga, cancellationToken));
            }, TimeSpan.FromSeconds(3));

            return(chaps);
        }
Exemple #2
0
        public async Task <IEnumerable <Chapter> > FindChapters(string manga, IProgress <int> progress, CancellationToken cancellationToken)
        {
            progress.Report(0);
            // find all chapters in a manga
            var chapters = await retry.DoAsync(() =>
            {
                return(DownloadAndParseChapters(manga, cancellationToken));
            }, TimeSpan.FromSeconds(3));

            progress.Report(100);
            return(chapters);
        }
Exemple #3
0
        public async Task Send(NimbusMessage message)
        {
            await _retry.DoAsync(async() =>
            {
                var brokeredMessage = await _brokeredMessageFactory.BuildBrokeredMessage(message);

                var messageSender = GetMessageSender();
                try
                {
                    await messageSender.SendAsync(brokeredMessage);
                }
                catch (MessagingEntityNotFoundException exc)
                {
                    _logger.Error(exc, "The referenced queue {QueuePath} no longer exists", _queuePath);
                    await _queueManager.MarkQueueAsNonExistent(_queuePath);
                    DiscardMessageSender();
                    throw;
                }
                catch (Exception)
                {
                    DiscardMessageSender();
                    throw;
                }
            },
                                 "Sending message to queue").ConfigureAwaitFalse();
        }
Exemple #4
0
        public async Task Send(NimbusMessage message)
        {
            await _retry.DoAsync(async() =>
            {
                var brokeredMessage = await _brokeredMessageFactory.BuildBrokeredMessage(message);

                var topicClient = GetTopicClient();
                try
                {
                    await topicClient.SendAsync(brokeredMessage);
                }
                catch (MessagingEntityNotFoundException exc)
                {
                    _logger.Error(exc, "The referenced topic path {TopicPath} no longer exists", _topicPath);
                    await _queueManager.MarkTopicAsNonExistent(_topicPath);
                    DiscardTopicClient();
                    throw;
                }
                catch (Exception)
                {
                    DiscardTopicClient();
                    throw;
                }
            },
                                 "Sending message to topic").ConfigureAwaitFalse();
        }
Exemple #5
0
        public async Task <IEnumerable <Chapter> > GetChapters(string manga, IProgress <string> progress, CancellationToken cancellationToken)
        {
            var chapters = await retry.DoAsync(() =>
            {
                return(GetChaptersImpl(manga, cancellationToken));
            }, TimeSpan.FromSeconds(3));

            return(chapters);
        }
Exemple #6
0
        public async Task <IEnumerable <Chapter> > FindChapters(string manga, IProgress <int> progress, CancellationToken cancellationToken)
        {
            Logger.Info($@"> FindChapters(): {manga}");
            progress.Report(0);

            // find all chapters in a manga
            IEnumerable <Chapter> chaps = await retry.DoAsync(() =>
            {
                return(DownloadAndParseChapters(manga, cancellationToken));
            }, TimeSpan.FromSeconds(3));

            progress.Report(100);

            // Insert missing URI schemes in each chapter's URI.
            // Provisional solution, the current implementation may not be the best way to go about it.
            chaps = chaps.Select(chap =>
            {
                chap.Url = $"http:{chap.Url}";
                return(chap);
            });

            return(chaps);
        }
        private Task <string[]> FetchExistingTopicSubscriptions(string topicPath)
        {
            return(Task.Run(() =>
            {
                return _retry.DoAsync(async() =>
                {
                    var subscriptions = await _managementClient().GetSubscriptionsAsync(topicPath);

                    return subscriptions
                    .Select(s => s.SubscriptionName)
                    .Select(subscriptionName => BuildSubscriptionKey(topicPath, subscriptionName))
                    .ToArray();
                },
                                      "Fetching topic subscriptions for " + topicPath);
            }).ConfigureAwaitFalse());
        }
Exemple #8
0
        public async Task <IEnumerable <Chapter> > GetChapters(string manga, IProgress <string> progress, CancellationToken cancellationToken)
        {
            Logger.Info($@"> FindChapters(): {manga}");

            IEnumerable <Chapter> chaps = await retry.DoAsync(() =>
            {
                return(GetChaptersImpl(manga, cancellationToken));
            }, TimeSpan.FromSeconds(3));

            chaps = chaps.Select(chap =>
            {
                chap.Url = $"https://fanfox.net{chap.Url}";
                return(chap);
            });

            return(chaps);
        }