1
mirror of https://github.com/thepeacockproject/Peacock synced 2025-02-23 03:35:25 +01:00

Fix challenges being able to cause a recursion deadlock

Happens rarely, see https://discord.com/channels/826809653181808651/1058021993661861938 for an explanation.
This commit is contained in:
Reece Dunham 2022-12-30 21:14:01 -05:00
parent a71bfff890
commit ba751852f1

@ -859,6 +859,14 @@ export class ChallengeService extends ChallengeRegistry {
assert.ok(allDeps, `No dep tree for ${depTreeId}`)
if (!allDeps.includes(challenge.Id)) {
// we don't care about this tree, it doesn't depend on the challenge
// note: without this check, a race condition can occur where two
// trees basically bounce back and forth between each other, causing
// an infinite loop
continue
}
// check if the dependency tree is completed
const completed = allDeps.every((depId) => {
const depProgression = this.getPersistentChallengeProgression(