bordaigorl / remy

Remy, an online&offline manager for the reMarkable tablet
GNU General Public License v3.0
279 stars 13 forks source link

xochitl not restarted when using "type": "rsync" #23

Closed vsht closed 2 years ago

vsht commented 3 years ago

It seems that the cleanup method of the LiveFileSourceRsync class is not called when the class is deleted. This effectively makes Remarkable freeze, unless one pushes the power button for several second or restarts xochitl via ssh.

A possible (admittedly very trivial) fix would be

---
 remy/remarkable/filesource.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/remy/remarkable/filesource.py b/remy/remarkable/filesource.py
index 41bb953..8cc9bfb 100644
--- a/remy/remarkable/filesource.py
+++ b/remy/remarkable/filesource.py
@@ -1,5 +1,6 @@
 import paramiko
 import os
+import atexit
 import shutil
 import os.path as path
 import json
@@ -398,6 +399,8 @@ class LiveFileSourceRsync(LiveFileSourceSSH):
     self.host = host
     self.username = username
     self.cache_mode = cache_mode
+    
+    atexit.register(self.cleanup)

     if rsync_path:
       self.RSYNC = [ rsync_path ]

Then it works as expected.

bordaigorl commented 3 years ago

Which branch are you using?

The cleanup method is only called if you performed an operation that requires xochitl to be restarted (e.g. uploading a new file). Otherwise it is not.

Unless you are using the use_banner option, in which case it should be restarted. (If you see it frozen it's probably because you are missing remarkable-splash).

vsht commented 3 years ago

I was on the master branch, but it seems that in the devel branch it works as expected. Ok, I will then just switch to devel.

BTW, I do use the use_banner option and I have remarkable-splash installed, but this doesn't seem to have any effect, since the use_banner option is not handled inside the LiveFileSourceRsync class.