kozec / syncthing-gtk

GTK3 & python based GUI for Syncthing
GNU General Public License v2.0
1.29k stars 140 forks source link

File manager integration: don't ping the daemon if it isn't running #492

Closed catb0t closed 5 years ago

catb0t commented 5 years ago

The file manager extensions will ping the daemon repeatedly if it's not running whenever the filemanager is running (i.e whenever the desktop is running), but this goes on forever because they (correctly) never start it

This is the same error that the GTK GUI gives except the GUI usually resolves it whenever the daemon launches.

E Daemon        g-io-error-quark: Could not connect to 127.0.0.1: Connection refused (39)
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/syncthing_gtk/daemon.py", line 1052, in _connected
    self._connection = self.connect_to_service_finish(results)

If the daemon doesn't reply after some refused connections, don't retry any further from the file manager extension?

I can try to draft a PR to fix this, if I can figure out the solution.

kozec commented 5 years ago

But if it stops retrying, it will not be able to tell if daemon eventually starts...

Is reconnecting really the problem, or just that it spams error messages?

catb0t commented 5 years ago

If the daemon is connectable when the file manager [window] starts, it should connect. If the daemon isn't connectable I think it should just disable itself (or ping less than once per second).

My actual issue with the current behaviour is performance, my file manager pinging localhost every second is a lot of CPU load, a waste of battery etc for this poor little laptop, and it also exacerbates an existing memory leak in Caja (by just looping, the same objects are allocated but never destroyed).

I have ST set to rescan every 100s at lowest priority, so ST itself doesn't represent a lot of CPU cycles.

Perhaps the file manager retry timeout could be increased from 1 second to 20 or 30, after refused connections?