-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use a stack channel for deserialization * multi-threaded * add object dictionary pool * more pooling * adjust sqlite transport * format * Optimize IsPropNameValid * object loader first pass * save test * add cache pre check * save better deserialize * mostly works * uses tasks but slower at end * rework to make more sense * add check to avoid multi-deserialize * modify max parallelism * async enqueuing of tasks * switch to more asyncenumerable * fmt * fmt * cleanup sqlite * make ServerObjectManager * revert change * add ability to skip cache check * cache json to know what is loaded * testing * clean up usage * clean up and added new op * Fix exception handling * fixing progress * remove codejam * Hides ObjectPool dependency * fmt * Use the 1.0 BCL async to try to be more compatible * rename to dependencies * Move Polly to internal dependencies * format * remove more old references * remove stackchannel * fixes for registration * remove console writeline * add cache check shortcut for root object * recevie2 benchmark * add test for deserialize new * Use same asyncinterfaces as Dynamo. Merge fixes * clean up * fix download object progress --------- Co-authored-by: Jedd Morgan <[email protected]>
- Loading branch information
1 parent
cca8828
commit b6d2d01
Showing
27 changed files
with
418 additions
and
427 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Polly; | ||
using Polly.Contrib.WaitAndRetry; | ||
|
||
namespace Speckle.Sdk.Dependencies; | ||
|
||
public static class GraphQLRetry | ||
{ | ||
public static async Task<T> ExecuteAsync<T, TException>( | ||
Func<Task<T>> func, | ||
Action<Exception, TimeSpan>? onRetry = null | ||
) | ||
where TException : Exception | ||
{ | ||
var delay = Backoff.DecorrelatedJitterBackoffV2(TimeSpan.FromSeconds(1), 5); | ||
var graphqlRetry = Policy | ||
.Handle<TException>() | ||
.WaitAndRetryAsync( | ||
delay, | ||
(ex, timeout, _) => | ||
{ | ||
onRetry?.Invoke(ex, timeout); | ||
} | ||
); | ||
|
||
return await graphqlRetry.ExecuteAsync(func).ConfigureAwait(false); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Microsoft.Extensions.ObjectPool; | ||
|
||
namespace Speckle.Sdk.Dependencies; | ||
|
||
public class Pool<T> | ||
where T : class, new() | ||
{ | ||
private readonly ObjectPool<T> _objectPool; | ||
|
||
internal Pool(IPooledObjectPolicy<T> objectPolicy) | ||
{ | ||
_objectPool = ObjectPool.Create(objectPolicy); | ||
} | ||
|
||
public T Get() => _objectPool.Get(); | ||
|
||
public void Return(T obj) => _objectPool.Return(obj); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Microsoft.Extensions.ObjectPool; | ||
|
||
namespace Speckle.Sdk.Dependencies; | ||
|
||
public static class Pools | ||
{ | ||
public static Pool<Dictionary<string, object?>> ObjectDictionaries { get; } = new(new ObjectDictionaryPolicy()); | ||
|
||
private sealed class ObjectDictionaryPolicy : IPooledObjectPolicy<Dictionary<string, object?>> | ||
{ | ||
public Dictionary<string, object?> Create() => new(50, StringComparer.OrdinalIgnoreCase); | ||
|
||
public bool Return(Dictionary<string, object?> obj) | ||
{ | ||
obj.Clear(); | ||
return true; | ||
} | ||
} | ||
|
||
public static Pool<List<string>> ListString { get; } = new(new ListStringPolicy()); | ||
|
||
private sealed class ListStringPolicy : IPooledObjectPolicy<List<string>> | ||
{ | ||
public List<string> Create() => new(20); | ||
|
||
public bool Return(List<string> obj) | ||
{ | ||
obj.Clear(); | ||
return true; | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/Speckle.Sdk.Dependencies/Speckle.Sdk.Dependencies.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>netstandard2.0;net8.0</TargetFrameworks> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<ILRepackTargetConfigurations>Debug;Release;Local</ILRepackTargetConfigurations> | ||
<ILRepackRenameInternalized>true</ILRepackRenameInternalized> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="ILRepack.FullAuto"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.Extensions.ObjectPool" PrivateAssets="all" /> | ||
<PackageReference Include="Polly" PrivateAssets="all" /> | ||
<PackageReference Include="Polly.Contrib.WaitAndRetry" PrivateAssets="all" /> | ||
<PackageReference Include="Polly.Extensions.Http" PrivateAssets="all" /> | ||
|
||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.