File tree 1 file changed +11
-9
lines changed
1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -19,15 +19,17 @@ export default async function getCommentsCached(postName: string) {
19
19
return data
20
20
} else {
21
21
if ( ! POST_COMMENTS_LOADING . get ( postName ) && ( Date . now ( ) - cached . timestamp > COMMENTS_CACHE_LIFETIME ) ) {
22
- try {
23
- // if comments are cached but expired, start updating them but return cached for now
24
- POST_COMMENTS_LOADING . set ( postName , true )
25
- loadAndRender ( postName )
26
- . then ( data =>
27
- COMMENTS_CACHE . set ( postName , { data, timestamp : Date . now ( ) } ) )
28
- . finally ( ( ) => POST_COMMENTS_LOADING . set ( postName , false ) )
29
- } catch {
30
- }
22
+ // if comments are cached but expired, start updating them but return cached for now
23
+ POST_COMMENTS_LOADING . set ( postName , true )
24
+
25
+ void ( async function ( ) {
26
+ try {
27
+ const data = await loadAndRender ( postName )
28
+ COMMENTS_CACHE . set ( postName , { data, timestamp : Date . now ( ) } )
29
+ } finally {
30
+ POST_COMMENTS_LOADING . set ( postName , false )
31
+ }
32
+ } ) ( )
31
33
}
32
34
33
35
return cached . data
You can’t perform that action at this time.
0 commit comments