2e3s / awatcher

Activity and idle watchers
Mozilla Public License 2.0
146 stars 5 forks source link

Config in aw-qt not working #5

Closed renyuneyun closed 1 year ago

renyuneyun commented 1 year ago

I'm trying to make aw-qt autostart awatcher. From the explanations, I now install awatcher's binary to /usr/bin/aw-awatcher. (I'm on archlinux.) Then, I changed ~/.config/activitywatch/aw-qt/aw-qt.toml, with the following content:

[aw-qt]
autostart_modules = ["aw-server", "aw-awatcher"]

(Tried changing order. Doesn't make any difference.)

During test, I verified that no activity process is running. Then, I launched aw-qt from terminal. However, awatcher is not correctly launched. In my terminal, I get the following:

~ via  
❯ aw-qt       
2023-11-26 17:54:47 [INFO ]: Started aw-qt...  (aw_qt.main:53)
2023-11-26 17:54:47 [WARNING]: Found matching file but was not executable: /opt/activitywatch/aw-server-rust/aw-server.service  (aw_qt.manager:64)
2023-11-26 17:54:47 [WARNING]: Found matching file but was not executable: /opt/activitywatch/aw-qt.desktop  (aw_qt.manager:64)
2023-11-26 17:54:47 [INFO ]: Found 6 bundled modules  (aw_qt.manager:85)
2023-11-26 17:54:47 [INFO ]: Found 6 system modules  (aw_qt.manager:119)
2023-11-26 17:54:47 [INFO ]: Starting module aw-server  (aw_qt.manager:148)
2023-11-26 17:54:47 [INFO ]: Starting module aw-awatcher  (aw_qt.manager:148)
Error: Failed to create bucket aw-watcher-afk_zr-yoga

Caused by:
    0: error sending request for url (http://localhost:5600/api/0/buckets/aw-watcher-afk_zr-yoga): error trying to connect: tcp connect error: Connection refused (os error 111)
    1: error trying to connect: tcp connect error: Connection refused (os error 111)
    2: tcp connect error: Connection refused (os error 111)
    3: Connection refused (os error 111)
2023-11-26 17:54:47 [INFO ]: Creating trayicon...  (aw_qt.trayicon:206)
aw-qt: symbol lookup error: /opt/activitywatch/libQt6WaylandClient.so.6: undefined symbol: wl_proxy_marshal_flags

~ via  
❯ 2023-11-26 17:54:47 [INFO ]: Using storage method: peewee  (aw_server.main:33)
2023-11-26 17:54:47 [INFO ]: Starting up...  (aw_server.main:41)
2023-11-26 17:54:47 [INFO ]: Using database file: /home/ryey/.local/share/activitywatch/aw-server/peewee-sqlite.v2.db  (aw_datastore.storages.peewee:150)
 * Serving Flask app 'aw-server'
 * Debug mode: off
2023-11-26 17:54:47 [INFO ]: WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://localhost:5600  (werkzeug:187)
2023-11-26 17:54:47 [INFO ]: Press CTRL+C to quit  (werkzeug:187)
2023-11-26 17:56:08 [INFO ]: Received heartbeat after pulse window, inserting as new event. (bucket: aw-watcher-web-firefox)  (aw_server.api:317)
2023-11-26 17:57:25 [WARNING]: Gap was of negative duration but could be safely merged (-105.614s). This message will only show once per batch.  (aw_transform.flood:46)
2023-11-26 17:57:29 [WARNING]: Gap was of negative duration but could be safely merged (-105.614s). This message will only show once per batch.  (aw_transform.flood:46)
2023-11-26 17:57:30 [WARNING]: Gap was of negative duration but could be safely merged (-100.97s). This message will only show once per batch.  (aw_transform.flood:46)

Now, aw-server is running, but aw-qt is not (nor is aw-awatcher). If I start aw-qt again, aw-awatcher will start, though aw-qt is still not, with that same symbol error, and error on port occupying (because aw-server is already running). So that symbol error seems to be related to aw-qt's tray icon itself.

I suspect this is because aw-qt starts all modules simultaneously, and awatcher quits itself while aw-server is still initializing.

2e3s commented 1 year ago

Thank you. With autostart_modules = ["aw-server-rust", "aw-awatcher"] it works ok because the rust server starts up fast, I guess. Which may be why I didn't notice the problem. Python client has a reconnect feature, and Rust client doesn't, that's a deficiency. I've added a quick workaround with 2 retries after 1s: https://github.com/2e3s/awatcher/releases/tag/v0.2.3

renyuneyun commented 1 year ago

Thanks for the swift update. I can confirm it's working now.

Based on your experience, do you think aw-server-rust is stable enough for daily use (personal use)? I'm hesitating to whether switching to it or not.

2e3s commented 1 year ago

Based on your experience, do you think aw-server-rust is stable enough for daily use (personal use)?

I've never faced any problem. However, I've started to use it since the beginning. Python and Rust servers use different folders for storage, I don't know if data can be just copied.