Skip to content

Commit

Permalink
Merge pull request #5788 from NuGet/dev
Browse files Browse the repository at this point in the history
[ReleasePrep][2018.04.05]RI of dev into master
  • Loading branch information
ryuyu authored Apr 10, 2018
2 parents 4607a1d + cddc6db commit 0976f84
Show file tree
Hide file tree
Showing 143 changed files with 7,189 additions and 1,432 deletions.
82 changes: 74 additions & 8 deletions src/Bootstrap/dist/css/bootstrap-theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions src/Bootstrap/less/theme/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -381,4 +381,24 @@ img.reserved-indicator-icon {
line-height:2em;
height: 2em;
color: @navbar-inverse-color;
}

.breadcrumb-title {
margin-bottom: 0px;
}

.breadcrumb-divider {
margin-top: 15px;
margin-bottom: 15px;
}

.breadcrumb-menu {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 33px;

h1 {
margin-top: 0px;
}
}
45 changes: 31 additions & 14 deletions src/Bootstrap/less/theme/page-manage-organizations.less
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,39 @@
border-style: hidden
}

.manage-members-listing {
margin-bottom: 0;
.members-list {
margin-top: 15px;

.heading-left {
padding-left: 5px;
}

.heading-right {
padding-right: 5px;
}
.manage-members-listing {
margin-bottom: 0;

.heading-left {
padding-left: 5px;
}

.heading-right {
padding-right: 5px;
}

.icon-left {
padding-left: 25px;
}

.icon-right {
padding-right: 20px;
}

.role-description {
margin-top: 15px;
margin-bottom: 25px;
}

.icon-left {
padding-left: 25px;
}
.alert {
margin-bottom: 5px;
}

.member-icon {
vertical-align: middle;
.row-center {
vertical-align: middle;
}
}
}
2 changes: 1 addition & 1 deletion src/Bootstrap/less/theme/page-manage-packages.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}

.subtitle {
margin-top: 24px;
margin-top: 33px;
}

.form-section-title {
Expand Down
17 changes: 15 additions & 2 deletions src/Bootstrap/less/theme/page-profile.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,32 @@

.profile-title {
margin-top: (@padding-large-vertical * 5);
margin-bottom: (@padding-large-vertical * 2);

display: flex;
justify-content: space-between;
align-items: baseline;

h1 {
display: inline;
font-size: 2.285em;
font-weight: 300;
margin-top: 0px;
margin-bottom: 0px;
}

.verified {
margin-left: @padding-large-horizontal;
color: @verified-color;
font-size: 14px;
}

.organization-subtitle-divider {
color: @gray-lighter;
}
}

.profile-title-divider {
margin-top: 10px;
margin-bottom: 10px;
}

.profile-details {
Expand Down
9 changes: 9 additions & 0 deletions src/Bootstrap/less/theme/page-transform-account.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
.page-transform-account {
.transform-alert {
margin-bottom: 33px;

.transform-alert-list {
margin-bottom: 15px;
margin-top: 15px;
}
}

.center-box {
display: flex;
justify-content: space-between;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ public sealed class RetryingHttpClientWrapper
private readonly HttpClient _httpClient;
private readonly IEndpointHealthIndicatorStore _endpointHealthIndicatorStore;

private static readonly Random Random = new Random((int) DateTime.UtcNow.Ticks);
private static readonly int PeriodToDelayAlternateRequest = 3000;
private static readonly IComparer<int> HealthComparer;

static RetryingHttpClientWrapper()
{
HealthComparer = new WeightedRandomComparer(Random);
HealthComparer = new WeightedRandomComparer();
}

public RetryingHttpClientWrapper(HttpClient httpClient)
Expand Down Expand Up @@ -212,27 +211,27 @@ private static bool ShouldTryOther(HttpResponseMessage response)

return false;
}
class WeightedRandomComparer

public class WeightedRandomComparer
: IComparer<int>
{
private readonly Random _random;

public WeightedRandomComparer(Random random)
{
_random = random;
}

public int Compare(int x, int y)
{
var totalWeight = x + y;
var randomNumber = _random.Next(0, totalWeight);
var randomNumber = ThreadSafeRandom.Next(0, totalWeight);

if (randomNumber < x)
{
return 1;
}
return -1;
else if (randomNumber > x)
{
return -1;
}
else
{
return 0;
}
}
}
}
Expand Down
46 changes: 46 additions & 0 deletions src/NuGet.Services.Search.Client/Client/ThreadSafeRandom.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;

namespace NuGet.Services.Search.Client
{
/// <summary>
/// A thread safe random implementation
/// https://blogs.msdn.microsoft.com/pfxteam/2009/02/19/getting-random-numbers-in-a-thread-safe-way/
/// </summary>
public static class ThreadSafeRandom
{
private static Random _global = new Random();

[ThreadStatic]
private static Random _local;

public static int Next()
{
Random inst = GetLocalInstance();
return inst.Next();
}

public static int Next(int min, int max)
{
Random inst = GetLocalInstance();
return inst.Next(min, max);
}

static Random GetLocalInstance()
{
Random inst = _local;
if (inst == null)
{
int seed;
lock (_global)
{
seed = _global.Next();
}
_local = inst = new Random(seed);
}
return inst;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
<Compile Include="Client\SearchClient.cs" />
<Compile Include="Client\ServiceDiscovery.cs" />
<Compile Include="Client\ServiceDiscoveryClient.cs" />
<Compile Include="Client\ThreadSafeRandom.cs" />
<Compile Include="Correlation\CorrelatingHttpClientHandler.cs" />
<Compile Include="Correlation\WebApiCorrelationHandler.cs" />
<Compile Include="Models\SearchResults.cs" />
Expand Down
Loading

0 comments on commit 0976f84

Please sign in to comment.