From 7447b3e5ed07a274ae4407772a643b4d478e4d94 Mon Sep 17 00:00:00 2001 From: uvok Date: Thu, 23 Jan 2025 20:28:35 +0100 Subject: Clean up imports --- fuse-ap.py | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/fuse-ap.py b/fuse-ap.py index f3fd478..fb476e9 100644 --- a/fuse-ap.py +++ b/fuse-ap.py @@ -1,19 +1,10 @@ import argparse import enum -import errno import logging -import time -import requests -import sys -import stat -from typing import Optional -from threading import Thread, Lock, Event -from queue import Queue +from threading import Thread, Event -import urllib.parse - from fuse import FUSE, fuse_exit from de_uvok.activitypub_fuse.fuse import StatusFileSystem @@ -64,7 +55,7 @@ def parse_arguments(): # todo: make this a loop supporting paging def status_fetcher(fs: StatusFileSystem, sp: StatusProvider, sig_quit: Event): max_id = "" - while (max_id is not None) and not (sig_quit.wait(5)): + while (max_id is not None) and not (sig_quit.wait(1)): logger.debug("Fetch statuses.") st_rep = sp.load_statuses(max_id) logger.debug("Add statuses to FS.") @@ -76,7 +67,7 @@ def status_fetcher(fs: StatusFileSystem, sp: StatusProvider, sig_quit: Event): def main(args): quit_evt = Event() - t = None + fetch_thread = None try: if args.api_choice == APIChoice.MASTODON: status_provider = MastodonStatusProvider(args.server, args.username) @@ -85,8 +76,8 @@ def main(args): myfs = StatusFileSystem() - t = Thread(target=status_fetcher, args=(myfs, status_provider, quit_evt)) - t.start() + fetch_thread = Thread(target=status_fetcher, args=(myfs, status_provider, quit_evt)) + fetch_thread.start() FUSE(myfs, args.mountpoint, nothreads=True, foreground=True) except: @@ -94,8 +85,8 @@ def main(args): raise finally: quit_evt.set() - if t: - t.join() + if fetch_thread: + fetch_thread.join() if __name__ == "__main__": -- cgit v1.2.3