def api_watch_checknow(): global messages uuid = request.args.get('uuid') running_update_threads[uuid] = fetch_site_status.perform_site_check( uuid=uuid, datastore=datastore) running_update_threads[uuid].start() return redirect(url_for('main_page'))
def launch_checks(): import fetch_site_status global running_update_threads minutes = datastore.data['settings']['requests']['minutes_between_check'] for uuid, watch in datastore.data['watching'].items(): if watch['last_checked'] <= time.time() - (minutes * 60): running_update_threads[ watch['uuid']] = fetch_site_status.perform_site_check( uuid=uuid, datastore=datastore) running_update_threads[watch['uuid']].start()
def api_watch_recheckall(): import fetch_site_status global running_update_threads i = 0 for uuid, watch in datastore.data['watching'].items(): i = i + 1 running_update_threads[ watch['uuid']] = fetch_site_status.perform_site_check( uuid=uuid, datastore=datastore) running_update_threads[watch['uuid']].start() return "{} triggered recheck of {} watches.".format( i, len(datastore.data['watching']))
def run(self): import fetch_site_status try: while True: uuid = self.q.get() # Blocking self.current_uuid = uuid if uuid in list(datastore.data['watching'].keys()): update_handler = fetch_site_status.perform_site_check( uuid=uuid, datastore=datastore) datastore.update_watch( uuid=uuid, update_obj=update_handler.update_data) self.current_uuid = None # Done self.q.task_done() except KeyboardInterrupt: return