Merge pull request #1047 from tgstation/FixChatBotLeak [TGSDeploy]

v4.3.3
This commit is contained in:
Jordan Brown
2020-06-11 18:46:28 -04:00
committed by GitHub
6 changed files with 17 additions and 6 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<!-- This is the authorative version list -->
<!-- Integration tests will ensure they match across the board -->
<TgsCoreVersion>4.3.2</TgsCoreVersion>
<TgsCoreVersion>4.3.3</TgsCoreVersion>
<TgsApiVersion>6.6.0</TgsApiVersion>
<TgsClientVersion>7.2.0</TgsClientVersion>
<TgsDmapiVersion>5.2.2</TgsDmapiVersion>
@@ -177,7 +177,7 @@ namespace Tgstation.Server.Host.Components.Chat.Providers
}
/// <inheritdoc />
public override async Task Disconnect(CancellationToken cancellationToken)
protected override async Task DisconnectImpl(CancellationToken cancellationToken)
{
Logger.LogTrace("Disconnecting...");
if (!Connected)
@@ -37,7 +37,7 @@ namespace Tgstation.Server.Host.Components.Chat.Providers
Task<bool> Connect(CancellationToken cancellationToken);
/// <summary>
/// Gracefully disconnects the provider. Implies a call to <see cref="IDisposable.Dispose"/>
/// Gracefully disconnects the provider. Permanently stops the reconnection timer.
/// </summary>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param>
/// <returns>A <see cref="Task"/> representing the running operation</returns>
@@ -346,7 +346,7 @@ namespace Tgstation.Server.Host.Components.Chat.Providers
}, cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Current);
/// <inheritdoc />
public override async Task Disconnect(CancellationToken cancellationToken)
protected override async Task DisconnectImpl(CancellationToken cancellationToken)
{
if (!Connected)
return;
@@ -87,8 +87,19 @@ namespace Tgstation.Server.Host.Components.Chat.Providers
/// <inheritdoc />
public abstract Task<bool> Connect(CancellationToken cancellationToken);
/// <summary>
/// Gracefully disconnects the provider.
/// </summary>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation.</param>
/// <returns>A <see cref="Task"/> representing the running operation.</returns>
protected abstract Task DisconnectImpl(CancellationToken cancellationToken);
/// <inheritdoc />
public abstract Task Disconnect(CancellationToken cancellationToken);
public async Task Disconnect(CancellationToken cancellationToken)
{
await StopReconnectionTimer().ConfigureAwait(false);
await DisconnectImpl(cancellationToken).ConfigureAwait(false);
}
/// <inheritdoc />
public abstract Task<IReadOnlyCollection<ChannelRepresentation>> MapChannels(IEnumerable<Api.Models.ChatChannel> channels, CancellationToken cancellationToken);
@@ -197,7 +197,7 @@ namespace Tgstation.Server.Host.Controllers
{
var query = DatabaseContext.ChatBots
.AsQueryable()
.Where(x => x.Id == id)
.Where(x => x.Id == id && x.InstanceId == Instance.Id)
.Include(x => x.Channels);
var results = await query.FirstOrDefaultAsync(cancellationToken).ConfigureAwait(false);