File tree Expand file tree Collapse file tree 2 files changed +6
-12
lines changed
Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -34,8 +34,6 @@ public record Song
3434
3535internal record Songs
3636{
37- private static Songs ? _shared ;
38-
3937 private readonly DateTimeOffset _pullTime ;
4038 private readonly ImmutableArray < Song > _songs ;
4139 private readonly FrozenDictionary < string , Song > _songsById ;
@@ -51,15 +49,15 @@ private static Songs SharedSongs
5149 {
5250 get
5351 {
54- if ( _shared is not null && DateTimeOffset . Now . AddHours ( 10 ) . Date == _shared . _pullTime . AddHours ( 10 ) . Date )
52+ if ( field is not null && DateTimeOffset . Now . AddHours ( 10 ) . Date == field . _pullTime . AddHours ( 10 ) . Date )
5553 {
56- return _shared ;
54+ return field ;
5755 }
5856
5957 DfResourceClient resource = new ( ) ;
60- _shared = ( Songs ) resource . GetSongsAsync ( ) . Result ;
58+ field = ( Songs ) resource . GetSongsAsync ( ) . Result ;
6159
62- return _shared ;
60+ return field ;
6361 }
6462 }
6563
Original file line number Diff line number Diff line change @@ -7,10 +7,6 @@ public record SongData
77{
88 private readonly DateTimeOffset _pullTime = DateTimeOffset . Now ;
99
10- private FrozenDictionary < int , Song > ? _songsById ;
11-
12- private FrozenDictionary < int , Version > ? _versionsByGroup ;
13-
1410 [ JsonPropertyName ( "songs" ) ]
1511 public required List < Song > Songs { get ; set ; }
1612
@@ -20,9 +16,9 @@ public record SongData
2016 [ JsonPropertyName ( "versions" ) ]
2117 public required List < Version > Versions { get ; set ; }
2218
23- public FrozenDictionary < int , Song > SongsById => _songsById ??= Songs . ToFrozenDictionary ( x => x . Id ) ;
19+ public FrozenDictionary < int , Song > SongsById => field ??= Songs . ToFrozenDictionary ( x => x . Id ) ;
2420
25- public FrozenDictionary < int , Version > VersionsByGroup => _versionsByGroup ??=
21+ public FrozenDictionary < int , Version > VersionsByGroup => field ??=
2622 Versions . GroupBy ( x => x . VersionNumber / 100 ) . ToFrozenDictionary ( x => x . Key , x => x . First ( ) ) ;
2723
2824 public static SongData Shared
You can’t perform that action at this time.
0 commit comments