Skip to content

Commit c52f0ef

Browse files
committed
无用代码清理
1 parent 73d2861 commit c52f0ef

3 files changed

Lines changed: 10 additions & 18 deletions

File tree

src/Stream/Vertex.Stream.InMemory/Consumer/ConsumerManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class ConsumerManager : IHostedService, IDisposable
2222
{
2323
private const int LockHoldingSeconds = 60;
2424
private const int HoldTime = 20 * 1000;
25-
private const int MonitTime = 60 * 2 * 1000;
25+
private const int MonitorTime = 60 * 2 * 1000;
2626
private const int CheckTime = 10 * 1000;
2727

2828
private readonly List<QueueInfo> queues;
@@ -86,7 +86,7 @@ public Task StartAsync(CancellationToken cancellationToken)
8686
this.logger.LogInformation("EventBus Background Service is starting.");
8787
}
8888

89-
this.distributedMonitorTime = new Timer(state => this.DistributedStart().Wait(), null, 1000, MonitTime);
89+
this.distributedMonitorTime = new Timer(state => this.DistributedStart().Wait(), null, 1000, MonitorTime);
9090
this.distributedHoldTimer = new Timer(state => this.DistributedHold().Wait(), null, HoldTime, HoldTime);
9191
this.heathCheckTimer = new Timer(state => { this.HeathCheck().Wait(); }, null, CheckTime, CheckTime);
9292
return Task.CompletedTask;

src/Stream/Vertex.Stream.Kafka/Consumer/ConsumerManager.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,16 @@ namespace Vertex.Stream.Kafka.Consumer
1717
public class ConsumerManager : IHostedService, IDisposable
1818
{
1919
private const int HoldTime = 20 * 1000;
20-
private const int MonitTime = 60 * 2 * 1000;
20+
private const int MonitorTime = 60 * 2 * 1000;
2121
private const int CheckTime = 10 * 1000;
2222
private const int LockHoldingSeconds = 60;
2323

2424
private readonly List<QueueInfo> queues;
2525
private readonly ILogger<ConsumerManager> logger;
26-
private readonly IKafkaClient client;
2726
private readonly IServiceProvider provider;
2827
private readonly IGrainFactory grainFactory;
29-
private readonly ConcurrentDictionary<string, ConsumerRunner> consumerRunners = new ConcurrentDictionary<string, ConsumerRunner>();
30-
private readonly ConcurrentDictionary<string, long> runners = new ConcurrentDictionary<string, long>();
28+
private readonly ConcurrentDictionary<string, ConsumerRunner> consumerRunners = new();
29+
private readonly ConcurrentDictionary<string, long> runners = new();
3130

3231
private Timer distributedHoldTimer;
3332
private Timer distributedMonitorTime;
@@ -39,16 +38,14 @@ public class ConsumerManager : IHostedService, IDisposable
3938

4039
public ConsumerManager(
4140
ILogger<ConsumerManager> logger,
42-
IKafkaClient client,
4341
IGrainFactory grainFactory,
4442
IServiceProvider provider)
4543
{
4644
this.provider = provider;
47-
this.client = client;
4845
this.logger = logger;
4946
this.grainFactory = grainFactory;
5047

51-
this.queues = new List<QueueInfo>();
48+
this.queues = [];
5249
foreach (var assembly in AssemblyHelper.GetAssemblies(logger))
5350
{
5451
foreach (var type in assembly.GetTypes())
@@ -87,7 +84,7 @@ public Task StartAsync(CancellationToken cancellationToken)
8784
this.logger.LogInformation("EventBus Background Service is starting.");
8885
}
8986

90-
this.distributedMonitorTime = new Timer(state => this.DistributedStart().Wait(), null, 1000, MonitTime);
87+
this.distributedMonitorTime = new Timer(state => this.DistributedStart().Wait(), null, 1000, MonitorTime);
9188
this.distributedHoldTimer = new Timer(state => this.DistributedHold().Wait(), null, HoldTime, HoldTime);
9289
this.heathCheckTimer = new Timer(state => { this.HeathCheck().Wait(); }, null, CheckTime, CheckTime);
9390
return Task.CompletedTask;

src/Stream/Vertex.Stream.Kafka/EventStreamFactory.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,21 @@
22
using System.Collections.Concurrent;
33
using System.Linq;
44
using System.Threading.Tasks;
5-
using Orleans;
65
using Vertex.Abstractions.Actor;
76
using Vertex.Abstractions.EventStream;
87
using Vertex.Abstractions.Exceptions;
98
using Vertex.Stream.Common;
10-
using Vertex.Utils;
119

1210
namespace Vertex.Stream.Kafka
1311
{
1412
public class EventStreamFactory : IEventStreamFactory
1513
{
16-
private readonly ConcurrentDictionary<Type, StreamAttribute> typeAttributes = new ConcurrentDictionary<Type, StreamAttribute>();
17-
private readonly ConcurrentDictionary<Type, ConsistentHash> hashDict = new ConcurrentDictionary<Type, ConsistentHash>();
18-
private readonly ConcurrentDictionary<string, EventStream> streamDict = new ConcurrentDictionary<string, EventStream>();
19-
private readonly IGrainFactory grainFactory;
14+
private readonly ConcurrentDictionary<Type, StreamAttribute> typeAttributes = new();
15+
private readonly ConcurrentDictionary<string, EventStream> streamDict = new();
2016
private readonly IKafkaClient client;
2117

22-
public EventStreamFactory(IKafkaClient client, IGrainFactory grainFactory)
18+
public EventStreamFactory(IKafkaClient client)
2319
{
24-
this.grainFactory = grainFactory;
2520
this.client = client;
2621
}
2722

0 commit comments

Comments
 (0)