do not publish twice on reconnect
This commit is contained in:
@@ -255,10 +255,10 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
|||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ConnectionDto> GetConnectionDto()
|
public async Task<ConnectionDto> GetConnectionDto(bool publishConnected = true)
|
||||||
{
|
{
|
||||||
var dto = await _mareHub!.InvokeAsync<ConnectionDto>(nameof(GetConnectionDto)).ConfigureAwait(false);
|
var dto = await _mareHub!.InvokeAsync<ConnectionDto>(nameof(GetConnectionDto)).ConfigureAwait(false);
|
||||||
Mediator.Publish(new ConnectedMessage(dto));
|
if (publishConnected) Mediator.Publish(new ConnectedMessage(dto));
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,7 +381,7 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
InitializeApiHooks();
|
InitializeApiHooks();
|
||||||
_connectionDto = await GetConnectionDto().ConfigureAwait(false);
|
_connectionDto = await GetConnectionDto(publishConnected: false).ConfigureAwait(false);
|
||||||
if (_connectionDto.ServerVersion != IMareHub.ApiVersion)
|
if (_connectionDto.ServerVersion != IMareHub.ApiVersion)
|
||||||
{
|
{
|
||||||
await StopConnection(ServerState.VersionMisMatch).ConfigureAwait(false);
|
await StopConnection(ServerState.VersionMisMatch).ConfigureAwait(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user