Commit 0e0fada1 authored by Savorboard's avatar Savorboard

code cleanup

parent a4f440dd
// Copyright (c) .NET Core Community. All rights reserved. // Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information. // Licensed under the MIT License. See License.txt in the project root for license information.
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace DotNetCore.CAP.Processor namespace DotNetCore.CAP.Processor
{ {
...@@ -48,21 +48,19 @@ namespace DotNetCore.CAP.Processor ...@@ -48,21 +48,19 @@ namespace DotNetCore.CAP.Processor
private async Task ProcessPublishedAsync(IStorageConnection connection, ProcessingContext context) private async Task ProcessPublishedAsync(IStorageConnection connection, ProcessingContext context)
{ {
var messages = await GetSafelyAsync(() => connection.GetPublishedMessagesOfNeedRetry()); var messages = await GetSafelyAsync(connection.GetPublishedMessagesOfNeedRetry);
foreach (var message in messages) foreach (var message in messages)
{ {
await _publishMessageSender.SendAsync(message); await _publishMessageSender.SendAsync(message);
context.ThrowIfStopping();
await context.WaitAsync(_delay); await context.WaitAsync(_delay);
} }
} }
private async Task ProcessReceivedAsync(IStorageConnection connection, ProcessingContext context) private async Task ProcessReceivedAsync(IStorageConnection connection, ProcessingContext context)
{ {
var messages = await GetSafelyAsync(() => connection.GetReceivedMessagesOfNeedRetry()); var messages = await GetSafelyAsync(connection.GetReceivedMessagesOfNeedRetry);
foreach (var message in messages) foreach (var message in messages)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment