From 304b61f87d5fc29c8c8da452e44ea6983d9e4087 Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Mon, 24 Jul 2023 00:50:51 +0300 Subject: [PATCH] randomize tag list --- main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 67d5455..fdd2fcc 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,7 @@ import asyncio import logging import os +import random from io import BytesIO from pathlib import Path from tempfile import TemporaryFile, TemporaryDirectory @@ -109,7 +110,7 @@ async def check_updates(): async with redis.lock('e621:update'): logging.warning('Lock acquired...') tag_list = [t.decode() for t in await redis.smembers('e621:subs')] - tag_list.sort() + random.shuffle(tag_list) for tl_idx in range(0, len(tag_list), 40): tags = ' '.join(f'~{tag}' for tag in tag_list[tl_idx: tl_idx + 40]) logging.warning(tags)