def next(key=None, user=None): """Responds with the milliseconds until the next image.""" try: milliseconds = schedule.delay(user) return text_response(str(milliseconds)) except ContentError as e: exception('Failed to create next content: %s' % e) return next_retry_response()
def next_retry_response(): """Creates a response for a next request with a fixed retry time.""" return text_response(str(NEXT_RETRY_DELAY_MILLIS))