File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
src/_lambda/content-cache-hydrator Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -191,12 +191,21 @@ const runContentCacheHydrator = async (event: ContentCacheHydratorEvent) => {
191191 }
192192} ;
193193
194+ const flushLogs = ( ) =>
195+ new Promise < void > ( ( resolve ) => {
196+ logger . flush ( ( ) => resolve ( ) ) ;
197+ } ) ;
198+
194199export const handler = async ( event : object , context : Context ) : Promise < void > => {
195200 const requestContext : RequestContext = {
196201 traceId : context . awsRequestId ,
197202 nextUrl : "" ,
198203 sessionId : "content-cache-hydrator" ,
199204 } ;
200205
201- await asyncLocalStorage . run ( requestContext , ( ) => runContentCacheHydrator ( event ) ) ;
206+ try {
207+ await asyncLocalStorage . run ( requestContext , ( ) => runContentCacheHydrator ( event ) ) ;
208+ } finally {
209+ await flushLogs ( ) ;
210+ }
202211} ;
You can’t perform that action at this time.
0 commit comments