Martchus / syncthingtray

Tray application and Dolphin/Plasma integration for Syncthing
https://martchus.github.io/syncthingtray/
Other
1.54k stars 43 forks source link

syncthingctl wait-for-idle for disconnected devices #199

Closed CaseOf closed 11 months ago

CaseOf commented 11 months ago

Relevant components

Is your feature request specific to a certain platform/environment? Please specify. No

Is your feature request related to a problem? Please describe. When running syncthingctl -w --dev [device-id-here] it does not consider to still wait for device to be online.

Describe the solution you'd like I would like wait-for-idle feature in syncthingctl to wait for a given device via --dev to be online and synced to trigger it being idle.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context When device is offline, I cannot guarantee sync is up to date on both devices. On my context, it is to wait all data to be synced to start a backup via borg on a script.

Martchus commented 11 months ago

The change https://github.com/Martchus/syncthingtray/commit/89caa7610287860c2661b0c663ef7d57dbe83f6d that I have committed on master should do the trick. It is a failry simple change so I assume it works. However, I haven't tested it yet. You might want to test it yourself by building from the master branch.

CaseOf commented 11 months ago

I did try from master, it is still ending the wait instantly on a disconnected device.

I did build this way: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="../bin" -DNO_MODEL=ON -DNO_FILE_ITEM_ACTION_PLUGIN=ON ..

Martchus commented 11 months ago

A stupid question, but have you actually used the newly introduced option --require-devs-connected? I did not change the default behavior because that would probably be an incompatible change.

I guess I'll be able to test this myself tomorrow.

The build command looks fine by the way (although I've never dared to specify a relative install prefix).

CaseOf commented 11 months ago

A stupid question, but have you actually used the newly introduced option --require-devs-connected? I did not change the default behavior because that would probably be an incompatible change.

Not that stupid, I did not try it before you mentioned it even if I did see it in your code ¯_(ツ)_/¯ Now that I’m using it on master, it is waiting while the device is disconnected but still waits once device connects, sync, and then idle. Is there something missing?

CaseOf commented 11 months ago

Maybe a trigger once device comes back online?

Martchus commented 11 months ago

Now that I’m using it on master, it is waiting while the device is disconnected but still waits once device connects, sync, and then idle.

You mean the CLI never stops waiting even if the device is connected and idling at some point? Not sure why it would get stuck this way. I suppose I need to debug this myself then.

CaseOf commented 11 months ago

Now that I’m using it on master, it is waiting while the device is disconnected but still waits once device connects, sync, and then idle.

You mean the CLI never stops waiting even if the device is connected and idling at some point? Not sure why it would get stuck this way. I suppose I need to debug this myself then.

that's what I meant

Martchus commented 11 months ago

I tested it myself and could reproduce the issue. There was nothing wrong with my change but there was something more fundamentally broken in the way device events are processed in the underlying library. It should be fixed on master so you might want to test it again yourself.

CaseOf commented 11 months ago

It seems to work as expected now. Thanks !