예제 #1
0
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'))
예제 #2
0
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()
예제 #3
0
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']))
예제 #4
0
    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