fix(DailyRecipe generate_recipe): [M] 修复获取随机菜谱时死循环的问题

[M] 修复获取随机菜谱时死循环的问题

Signed-off-by: Ching <loooching@gmail.com>
This commit is contained in:
Ching 2021-10-05 16:03:08 +08:00
parent 6887140a4e
commit d2d6af2cca

View File

@ -55,6 +55,8 @@ class DailyRecipe(models.Model):
if recipe and recipe.id not in recipes and recipe.id not in prev_recipes:
recipes.append(recipe.id)
break
else:
retry -= 1
if retry <= 0:
retry = 5
break
@ -68,6 +70,7 @@ class DailyRecipe(models.Model):
if recipe and recipe.id not in recipes and recipe.id not in prev_recipes:
recipes.append(recipe.id)
break
else:
retry -= 1
if retry <= 0:
retry = 5