diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2016-04-01 03:13:16 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2016-04-04 11:57:32 +0300 |
commit | 268af24f2814ad30b23fc5e40e5c43bf994df444 (patch) | |
tree | 391725055b937470a736ebd36d114c55e9cb04de | |
parent | 44c6acc7bfd161dda54dd03ad72d00776f3b54e4 (diff) |
Remove the !reminder-timestamp file if it's no longer needed
If we didn't have to ignore any files because there is no !ready, we no
longer need the timestamp of the last reminder about that, so we can remove
the !reminder-timestamp file.
This means that for a given maintainer, if another instance of missing
!ready occurs, the reminder is issued immediately, rather than being delayed
until the time the reminder for the first instance was scheduled.
-rw-r--r-- | uploads.py | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -71,6 +71,7 @@ def scan(m, all_packages, args): reminder_time = os.path.getmtime(reminder_file) else: reminder_time = 0 + reminders = False logging.debug("reminder-timestamp %d, interval %d, next reminder %d, current time %d" % (reminder_time, REMINDER_INTERVAL, reminder_time + REMINDER_INTERVAL, time.time())) # scan package directories @@ -128,6 +129,7 @@ def scan(m, all_packages, args): # only process files newer than !ready if os.path.getmtime(fn) > mtime: if mtime == 0: + reminders = True lvl = logging.INFO # if more than REMINDER_INTERVAL has elapsed since we warned @@ -173,6 +175,13 @@ def scan(m, all_packages, args): if package.read_package(packages, basedir, dirpath, files, strict=True): error = True + # if we didn't need to check the reminder timestamp, it can be reset + if not reminders and not args.dryrun: + try: + os.remove(reminder_file) + except FileNotFoundError: + pass + return (error, packages, move, vault, remove, remove_success) |