Skip to content

Commit

Permalink
Increase type caches TTL from 10 seconds to 5 minutes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustavo Guerra committed Apr 9, 2018
1 parent 05e094c commit 33a20a3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 3.0.0-beta3 - Unreleased
* Increased type caches TTL from 10 seconds to 5 minutes.

#### 3.0.0-beta2 - April 09 2018
* Fixed memory leaks inside the the type provider design time components.
* Improved the performance of the type provider design time components.
Expand Down
8 changes: 4 additions & 4 deletions src/CommonProviderImplementation/Helpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ type DisposableTypeProviderForNamespaces(config, ?assemblyReplacementMap) as x =

member __.SetFileToWatch(fullTypeName, path) =
lock filesToWatch <| fun () ->
filesToWatch.Add(fullTypeName, path)
filesToWatch.[fullTypeName] <- path

member __.GetFileToWath(fullTypeName) =
lock filesToWatch <| fun () ->
Expand Down Expand Up @@ -283,7 +283,7 @@ module internal ProviderHelpers =
// the constructor from a text reader to an array of the representation
CreateFromTextReaderForSampleList : Expr<TextReader> -> Expr }

let private providedTypesCache = createInMemoryCache (TimeSpan.FromSeconds 10.)
let private providedTypesCache = createInMemoryCache (TimeSpan.FromMinutes 5.)
let private activeDisposeActions = HashSet<_>()

// Cache generated types for a short time, since VS invokes the TP multiple tiems
Expand Down Expand Up @@ -324,7 +324,7 @@ module internal ProviderHelpers =
// so we need to remove the dispose action so it will won't be added when disposed is called with B
true
| _ ->
log (sprintf "Caching %s [%d] for 10 seconds" fullTypeName tp.Id)
log (sprintf "Caching %s [%d] for 5 minutes" fullTypeName tp.Id)
providedTypesCache.Set(fullTypeName, (providedType, fullKey, fileToWatch))
// for the case where a file used by two TPs, when the file changes
// there will be two invalidations: A and B
Expand All @@ -339,7 +339,7 @@ module internal ProviderHelpers =
providedType
| _ ->
let providedType = f()
log "Caching for 10 seconds"
log "Caching for 5 minutes"
let fileToWatch = tp.GetFileToWath(fullTypeName)
providedTypesCache.Set(fullTypeName, (providedType, fullKey, fileToWatch))
setupDisposeAction providedType fileToWatch
Expand Down
12 changes: 6 additions & 6 deletions src/FSharp.Data.DesignTime/FSharp.Data.DesignTime.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@
<!-- We place BOTH the design-time DLLs in well-known locations with resepct to the runtime DLL -->
<!-- This enables any runtime DLL to be used with any host tooling running in either netcoreapp2.0+ or net461+ -->
<Target Name="AfterBuild">
<Copy SourceFiles="..\FSharp.Data.DesignTime\bin\$(Configuration)\$(TargetFramework)\FSharp.Data.DesignTime.dll" DestinationFolder="..\..\bin\typeproviders\fsharp41\$(TargetFramework)" />
<Copy SourceFiles="..\FSharp.Data.DesignTime\bin\$(Configuration)\$(TargetFramework)\FSharp.Data.DesignTime.pdb" DestinationFolder="..\..\bin\typeproviders\fsharp41\$(TargetFramework)" />
<Copy SourceFiles="..\FSharp.Data.DesignTime\bin\$(Configuration)\$(TargetFramework)\FSharp.Data.DesignTime.dll" DestinationFolder="..\..\bin\typeproviders\fsharp41\$(TargetFramework)" />
<Copy SourceFiles="..\FSharp.Data.DesignTime\bin\$(Configuration)\$(TargetFramework)\FSharp.Data.DesignTime.pdb" DestinationFolder="..\..\bin\typeproviders\fsharp41\$(TargetFramework)" />
<!-- For legacy compat (to load into pre VS2017 15.6+ or FCS 20.x.x+ tooling) we place a copy of the .NET 4.x TPDTC DLL alongside the TPRTC DLL -->
<Copy SourceFiles="..\FSharp.Data.DesignTime\bin\$(Configuration)\$(TargetFramework)\FSharp.Data.DesignTime.dll" DestinationFolder="..\..\bin\lib\net45" Condition="'$(TargetFramework)' == 'net45'" />
<Copy SourceFiles="..\FSharp.Data.DesignTime\bin\$(Configuration)\$(TargetFramework)\FSharp.Data.DesignTime.pdb" DestinationFolder="..\..\bin\lib\net45" Condition="'$(TargetFramework)' == 'net45'" />
<Copy SourceFiles="..\FSharp.Data.DesignTime\bin\$(Configuration)\$(TargetFramework)\FSharp.Data.DesignTime.dll" DestinationFolder="..\..\bin\lib\netstandard2.0" Condition="'$(TargetFramework)' == 'net45'" />
<Copy SourceFiles="..\FSharp.Data.DesignTime\bin\$(Configuration)\$(TargetFramework)\FSharp.Data.DesignTime.pdb" DestinationFolder="..\..\bin\lib\netstandard2.0" Condition="'$(TargetFramework)' == 'net45'" />
<Copy SourceFiles="..\FSharp.Data.DesignTime\bin\$(Configuration)\$(TargetFramework)\FSharp.Data.DesignTime.dll" DestinationFolder="..\..\bin\lib\net45" Condition="'$(TargetFramework)' == 'net45'" />
<Copy SourceFiles="..\FSharp.Data.DesignTime\bin\$(Configuration)\$(TargetFramework)\FSharp.Data.DesignTime.pdb" DestinationFolder="..\..\bin\lib\net45" Condition="'$(TargetFramework)' == 'net45'" />
<Copy SourceFiles="..\FSharp.Data.DesignTime\bin\$(Configuration)\$(TargetFramework)\FSharp.Data.DesignTime.dll" DestinationFolder="..\..\bin\lib\netstandard2.0" Condition="'$(TargetFramework)' == 'net45'" />
<Copy SourceFiles="..\FSharp.Data.DesignTime\bin\$(Configuration)\$(TargetFramework)\FSharp.Data.DesignTime.pdb" DestinationFolder="..\..\bin\lib\netstandard2.0" Condition="'$(TargetFramework)' == 'net45'" />
</Target>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>
6 changes: 3 additions & 3 deletions src/FSharp.Data/FSharp.Data.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
<!-- We place BOTH the design-time DLLs in well-known locations with resepct to the runtime DLL -->
<!-- This enables any runtime DLL to be used with any host tooling running in either netcoreapp2.0+ or net461+ -->
<Target Name="AfterBuild">
<Copy SourceFiles="$(OutputPath)\FSharp.Data.dll" DestinationFolder="..\..\bin\lib\$(TargetFramework)" />
<Copy SourceFiles="$(OutputPath)\FSharp.Data.pdb" DestinationFolder="..\..\bin\lib\$(TargetFramework)" />
<Copy SourceFiles="$(OutputPath)\FSharp.Data.xml" DestinationFolder="..\..\bin\lib\$(TargetFramework)" />
<Copy SourceFiles="$(OutputPath)\FSharp.Data.dll" DestinationFolder="..\..\bin\lib\$(TargetFramework)" />
<Copy SourceFiles="$(OutputPath)\FSharp.Data.pdb" DestinationFolder="..\..\bin\lib\$(TargetFramework)" />
<Copy SourceFiles="$(OutputPath)\FSharp.Data.xml" DestinationFolder="..\..\bin\lib\$(TargetFramework)" />
</Target>

</Project>

0 comments on commit 33a20a3

Please sign in to comment.