Skip to content

Commit 01f8c93

Browse files
committed
Simplify HostApplicationLifetime instantiation
Removed the `cancellationTokenSource` parameter from the instantiation of `HostApplicationLifetime` when adding it as a singleton service to the `Services` collection. This change decouples `HostApplicationLifetime` from `CancellationTokenSource`, potentially simplifying lifecycle management and addressing specific design requirements.
1 parent 49d5ac4 commit 01f8c93

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Sources/TelegramBot/Builders/BotBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public IBot Build()
141141
Services.AddSingleton<IKeyValueProvider, InMemoryKeyValueProvider>();
142142
}
143143
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
144-
Services.AddSingleton<IHostApplicationLifetime, HostApplicationLifetime>(x => new HostApplicationLifetime(cancellationTokenSource));
144+
Services.AddSingleton<IHostApplicationLifetime, HostApplicationLifetime>(x => new HostApplicationLifetime());
145145
return new BotApp(client, Services.BuildServiceProvider(), cancellationTokenSource);
146146
}
147147
}

0 commit comments

Comments
 (0)