Example #1
0
# noinspection PyProtectedMember
def restart_automatically(time_in_seconds):
    time.sleep(time_in_seconds)
    Metasmoke.send_statistics(False)  # false indicates not to auto-repeat
    os._exit(1)


Thread(name="auto restart thread",
       target=restart_automatically,
       args=(21600, )).start()

log('info', GlobalVars.location)
log('info', GlobalVars.metasmoke_host)

DeletionWatcher.update_site_id_list()

ws = websocket.create_connection("wss://qa.sockets.stackexchange.com/")
ws.send("155-questions-active")

GlobalVars.charcoal_hq.join()
GlobalVars.charcoal_hq.watch_socket(watcher)

if 'charcoal-hq-only' not in sys.argv:
    GlobalVars.tavern_on_the_meta.join()
    GlobalVars.socvr.join()
    GlobalVars.tavern_on_the_meta.watch_socket(watcher)
    GlobalVars.socvr.watch_socket(watcher)

    for room in GlobalVars.specialrooms:
        if "watcher" in room:
Example #2
0
    },
    {
        "sites": ["ru.stackoverflow.com"],
        "room": GlobalVars.wrap.get_room("22462"),
        "unwantedReasons": []
    }
]


def restart_automatically(time_in_seconds):
    time.sleep(time_in_seconds)
    os._exit(1)

Thread(target=restart_automatically, args=(21600,)).start()

DeletionWatcher.update_site_id_list()

ws = websocket.create_connection("ws://qa.sockets.stackexchange.com/")
ws.send("155-questions-active")
GlobalVars.charcoal_hq.join()
GlobalVars.tavern_on_the_meta.join()
GlobalVars.socvr.join()

GlobalVars.charcoal_hq.watch_socket(watcher)
GlobalVars.tavern_on_the_meta.watch_socket(watcher)
GlobalVars.socvr.watch_socket(watcher)
for room in GlobalVars.specialrooms:
    if "watcher" in room:
        room["room"].join()
        room["room"].watch_socket(special_room_watcher)
Example #3
0
            'WS failed to create websocket connection. Attempt {} of {}.'.
            format(attempt, max_attempts))
        return None


max_tries = 5
for tries in range(1, 1 + max_tries, 1):
    ws = setup_websocket(tries, max_tries)
    if ws:
        break
else:
    log('error',
        'Max retries exceeded. Exiting, maybe a restart will kick things.')
    os._exit(5)

GlobalVars.deletion_watcher = DeletionWatcher()

if "first_start" in sys.argv and GlobalVars.on_master:
    chatcommunicate.tell_rooms_with("debug", GlobalVars.s)
elif "first_start" in sys.argv and not GlobalVars.on_master:
    chatcommunicate.tell_rooms_with("debug", GlobalVars.s_reverted)

Tasks.periodic(Metasmoke.send_statistics, interval=600)

metasmoke_ws_t = Thread(name="metasmoke websocket",
                        target=Metasmoke.init_websocket)
metasmoke_ws_t.start()

while True:
    try:
        a = ws.recv()