randomize tag list

This commit is contained in:
bakatrouble 2023-07-24 00:50:51 +03:00
parent cc46539ea9
commit 304b61f87d

View File

@ -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)