def _check_post_time(self): print('checking last post time') last_post = hitmanager.last_post_time() or 0 print('last post at %s' % str(last_post)) temps_perdu = time.time() - last_post if last_post and temps_perdu < (self.post_interval / 2): print('skipping post. %d elapsed, post_interval %d' % (temps_perdu, self.post_interval)) self.sleep(self.post_interval)
def info(): """ returns some basic stats about what's happening on the server. """ auth = request.get_header('Authorization') if not authenticate(auth): return stats_dict = stats.stats_dict() new_hits = hitmanager.new_hits_count() last_post = hitmanager.last_post_time() return {'stats': stats_dict, 'new_hits': new_hits, 'last_post': last_post}