Skip to content

Commit

Permalink
Merge pull request #1339 from tgstation/RunningOutOfPatchBranchNames …
Browse files Browse the repository at this point in the history
…[TGSDeploy]

Fix repository progress calculations
  • Loading branch information
Cyberboss authored Oct 5, 2021
2 parents c52d587 + 19d2d75 commit 575484b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build/Version.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- Integration tests will ensure they match across the board -->
<Import Project="ControlPanelVersion.props" />
<PropertyGroup>
<TgsCoreVersion>4.15.2</TgsCoreVersion>
<TgsCoreVersion>4.15.3</TgsCoreVersion>
<TgsConfigVersion>4.0.0</TgsConfigVersion>
<TgsApiVersion>9.3.0</TgsApiVersion>
<TgsApiLibraryVersion>9.3.0</TgsApiLibraryVersion>
Expand Down
9 changes: 7 additions & 2 deletions src/Tgstation.Server.Host/Components/Chat/ChatManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -593,16 +593,20 @@ async Task ProcessMessage(IProvider provider, Message message, CancellationToken
}

// map the channel if it's private and we haven't seen it
var providerChannelId = message.User.Channel.RealId;
KeyValuePair<ulong, ChannelMapping>? mappedChannel;
long providerId;
lock (providers)
{
// important, otherwise we could end up processing during shutdown
cancellationToken.ThrowIfCancellationRequested();

providerId = providers
.Where(x => x.Value == provider)
.Select(x => x.Key)
.First();
mappedChannel = mappedChannels
.Where(x => x.Value.ProviderId == providerId && x.Value.ProviderChannelId == message.User.Channel.RealId)
.Where(x => x.Value.ProviderId == providerId && x.Value.ProviderChannelId == providerChannelId)
.FirstOrDefault();
}

Expand Down Expand Up @@ -648,7 +652,8 @@ await SendMessage(
return;
}

var mapping = mappedChannel.Value.Value;
var mappingNonNullableKvp = mappedChannel.Value;
var mapping = mappingNonNullableKvp.Value;

message.User.Channel.Id = mapping.Channel.Id;
message.User.Channel.Tag = mapping.Channel.Tag;
Expand Down
4 changes: 2 additions & 2 deletions src/Tgstation.Server.Host/Components/Repository/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ await Task.WhenAll(
CheckoutProgressHandler CheckoutProgressHandler(JobProgressReporter progressReporter, string stage) => (a, completedSteps, totalSteps) =>
{
int? percentage;
if (totalSteps > completedSteps || totalSteps == 0)
if (totalSteps < completedSteps || totalSteps == 0)
percentage = null;
else
{
Expand Down Expand Up @@ -1053,7 +1053,7 @@ TransferProgressHandler TransferProgressHandler(JobProgressReporter progressRepo
float? percentage;
var totalObjectsToProcess = transferProgress.TotalObjects * 2;
var processedObjects = transferProgress.IndexedObjects + transferProgress.ReceivedObjects;
if (totalObjectsToProcess > processedObjects || totalObjectsToProcess == 0)
if (totalObjectsToProcess < processedObjects || totalObjectsToProcess == 0)
percentage = null;
else
{
Expand Down

0 comments on commit 575484b

Please sign in to comment.