Skip to content

Commit

Permalink
change check_age to paper_too_young and check_queue to paper_in_queue
Browse files Browse the repository at this point in the history
also make the code pattern nicer
  • Loading branch information
mpacer committed Apr 8, 2018
1 parent 932dd1e commit 47f75fb
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions procbuild/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def listen(self):
self.dont_build.add(paper_to_build)
await self.queue.put(paper_to_build)

def check_age(self, nr):
def paper_too_young(self, nr):
"""Check the age of a PR's status_file based on its number.
Parameters
Expand All @@ -68,24 +68,22 @@ def check_age(self, nr):
"""
age = file_age(status_file(nr))
min_wait = 0.5
too_young = False
if age is not None and age <= min_wait:
too_young = age is not None and age <= min_wait
if too_young:
log(f"Did not build paper {nr}--recently built.")
too_young = True
return too_young

def check_queue(self, nr):
def paper_in_queue(self, nr):
"""Check whether the queue currently contains a build request for a PR.
Parameters
----------
nr : int
the number of the PR to check
"""
in_queue = False
if nr in self.dont_build:
in_queue = nr in self.dont_build
if in_queue:
log(f"Did not queue paper {nr}--already in queue.")
in_queue = True
return in_queue

def report_status(self, nr):
Expand Down

0 comments on commit 47f75fb

Please sign in to comment.