lahwaacz/wiki-scripts

toc.py: check date of last update

Closed this issue · 4 comments

I was thinking that probably toc.py should prevent multiple updates in the same UTC day, like statistics.py.[1]

Otherwise, toc.py has an unused --force option.[2]

Yep, I was thinking about this too lately... Do you think that a2f8520 is enough?

Yep, same code as statistics.py, however that script aborts the operation sooner if the page has already been saved in the same day; what would you think about moving the date test to around L480, perhaps also checking self.cliargs.save? (very minor nitpicking, I know, the script works brilliantly regardless of this!)

if self.cliargs.save and not self.cliargs.force and datetime.datetime.utcnow().date() <= parse_date(timestamp).date():
    logger.info("The page '{}' has already been updated this UTC day.".format(title))
    continue

Well, that would not save a single query to the server, only a few CPU cycles. And the warnings would be hidden until the following UTC day...

Indeed, I was only looking at the consistency with the other script, but the current version is optimal, thanks, I'll close this for you :)