Add a sitemap.txt for popular public repos

and reference it from the robots.txt
This commit is contained in:
Jake Moshenko 2016-06-17 13:52:27 -04:00
parent c712be05e2
commit a1cf12e460
11 changed files with 146 additions and 52 deletions

View file

@ -10,6 +10,10 @@ POLL_PERIOD_SECONDS = 10
logger = logging.getLogger(__name__)
def count_repository_actions():
""" Aggregates repository actions from the LogEntry table and writes them to
the RepositoryActionCount table. Returns the number of repositories for
which actions were logged. Returns 0 when there is no more work.
"""
try:
# Get a random repository to count.
today = date.today()
@ -32,11 +36,14 @@ def count_repository_actions():
# Create the row.
try:
RepositoryActionCount.create(repository=to_count, date=yesterday, count=actions)
return 1
except:
logger.exception('Exception when writing count')
except Repository.DoesNotExist:
logger.debug('No further repositories to count')
return 0
class RepositoryActionCountWorker(Worker):
def __init__(self):