Delay before shutdown
From: Pluto Crat [email protected]
A small delay before shutdown would be good, perhaps configurable by the preferences page too. "Delay xx seconds". The reason for this is often when the plugin triggers there is still a small amount of data to download. When I unsuspend / restart the computer Deluge still needs a few seconds to get the rest of the file. If I don't allow it to do this, the file is corrupted and useless.
Hi, just had another thought about this. Basically I think your code initiates shutdown/suspend when the torrent status turns from downloading to seeding. However at this point, there is still data being retrieved. Maybe if you triggered it when status=seeding AND download speed=0, that would be better, and the full file would be retrieved before shutdown triggers.
I suspect that the data has not been flushed to disk so could try flush_cache and wait for cache_flushed_alert before calling shutdown method.
It might be worth asking the libtorrent dev whether we should expect the data to have been flushed to disk upon receiving a torrent_finished_alert.