diff options
author | uvok | 2025-01-23 20:28:35 +0100 |
---|---|---|
committer | uvok | 2025-01-23 20:28:35 +0100 |
commit | 7447b3e5ed07a274ae4407772a643b4d478e4d94 (patch) | |
tree | 2ef68b3238bc7734bd27d76e619bac0419605718 | |
parent | 0e271287e942bfea8d1f3753a5725553e7500650 (diff) |
Clean up imports
-rw-r--r-- | fuse-ap.py | 23 |
1 files changed, 7 insertions, 16 deletions
@@ -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__": |