Skip to content

Commit 482c00c

Browse files
committed
fix(packages/graphql): make sure that instance cache data is also marked for removal when closing the block without student responses
1 parent a537d73 commit 482c00c

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

packages/graphql/src/services/liveQuizzes.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3277,6 +3277,7 @@ export const handleAssessmentLiveQuizBlockClosureAggregation: HatchetHandlers['h
32773277
)
32783278
return true
32793279
}
3280+
32803281
if (quiz.blocks.length === 0) {
32813282
executionCtx.logger.error(`Quiz with ID ${liveQuizId} has no blocks`)
32823283
return false
@@ -3291,6 +3292,7 @@ export const handleAssessmentLiveQuizBlockClosureAggregation: HatchetHandlers['h
32913292
)
32923293
return false
32933294
}
3295+
32943296
if (block.elements.length === 0) {
32953297
executionCtx.logger.error(
32963298
`Block with ID ${blockId} in quiz with ID ${liveQuizId} has no elements`
@@ -3302,6 +3304,22 @@ export const handleAssessmentLiveQuizBlockClosureAggregation: HatchetHandlers['h
33023304
executionCtx.logger.info(
33033305
`No responses found for any element in block with ID ${blockId} in quiz with ID ${liveQuizId}`
33043306
)
3307+
3308+
try {
3309+
// remove all cache entries related to this block only (or the entire live quiz, if this was the last block)
3310+
await removeCacheEntriesBlock({
3311+
liveQuizId,
3312+
blockId,
3313+
block,
3314+
isLastBlock,
3315+
redis: globalCtx.redisAssessmentExec,
3316+
})
3317+
} catch (error) {
3318+
executionCtx.logger.error(
3319+
`Error removing cache entries for block with ID ${blockId} in quiz with ID ${liveQuizId}: ${error}`
3320+
)
3321+
}
3322+
33053323
return true
33063324
}
33073325

0 commit comments

Comments
 (0)