randomize scraping interval

master
lub 5 years ago
parent 586dcf15de
commit 63e878ae7d

@ -4,6 +4,7 @@ import requests
import re
from bs4 import BeautifulSoup
from datetime import datetime, timedelta
from random import randrange
import asyncio
from nio import ClientConfig, AsyncClient, LoginResponse, InviteEvent
@ -171,7 +172,8 @@ async def main():
state_key=category,
content={'url_list': cache})
next_update = datetime.now() + timedelta(minutes=15)
# wait between 15min and 30min to randomize scraping
next_update = datetime.now() + timedelta(minutes=randrange(15, 30))
homeserver = environ['HOMESERVER']

Loading…
Cancel
Save