Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added watch folder again #8306

Merged
merged 2 commits into from
Dec 5, 2024
Merged

Conversation

qstokkink
Copy link
Contributor

Fixes #8280

This PR:

  • Adds the watch folder back again.
  • Fixes a bug in the settings endpoint that would not allow new settings to be written.
  • Removes the unused watch_folder_corrupt_file notification.
  • Removes the unused family filter and hide tags settings.

@qstokkink qstokkink force-pushed the add_watch_folder_again branch from 0b74598 to eee688a Compare December 4, 2024 14:24
@qstokkink qstokkink changed the title WIP: Add watch folder again READY: Added watch folder again Dec 4, 2024
@qstokkink qstokkink marked this pull request as ready for review December 4, 2024 14:35
Copy link
Member

@egbertbouman egbertbouman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand the new logic. Why are we removing downloads now?

Also, why use replace_task? What's wrong with processing torrents one at a time?

@qstokkink
Copy link
Contributor Author

Why are we removing downloads now?

🤔 In retrospect, maybe this was overly ambitious. I turned this into folder synchronization, while all we needed was a watch folder. I'll remove this.

Also, why use replace_task?

If the previous task is still pending and we re-enter the loop (i.e., for some reason this has not completed after 10 seconds), as opposed to catching a RuntimeError if the task already exists, I chose to cancel the previous task and retry with a new task. I opted for this because there is a (extremely small) chance that a new .torrent with newer metainfo was added for the same infohash, and try .. except RuntimeError .. is less aesthetically pleasing to me.

@qstokkink qstokkink changed the title READY: Added watch folder again WIP: Added watch folder again Dec 4, 2024
@qstokkink qstokkink marked this pull request as draft December 4, 2024 20:14
@qstokkink qstokkink force-pushed the add_watch_folder_again branch from eee688a to 5087eba Compare December 5, 2024 08:01
@qstokkink qstokkink changed the title WIP: Added watch folder again READY: Added watch folder again Dec 5, 2024
@qstokkink qstokkink marked this pull request as ready for review December 5, 2024 08:08
@qstokkink
Copy link
Contributor Author

@egbertbouman fixed up.

If you don't accept my reasoning and/or feel strongly about avoiding replace_task, please offer an alternative implementation.

Copy link
Member

@egbertbouman egbertbouman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The interval_runner of register_task waits 10s seconds in between tasks, so if you simply await it (and don't create an additional task), there is no problem. Having said that, I don't have strong feelings about this. I was just curious.

@qstokkink
Copy link
Contributor Author

I don't really see how you could avoid creating additional tasks, with start_download and TorrentDef.load being async. That said, if you do see a way to make this sexier/learner/meaner, that would be cool. For now, I'll merge this - but feel free to make a follow-up PR with sexification.

@qstokkink qstokkink merged commit 1b48255 into Tribler:main Dec 5, 2024
7 checks passed
@qstokkink qstokkink deleted the add_watch_folder_again branch December 5, 2024 09:20
@egbertbouman
Copy link
Member

I don't really see how you could avoid creating additional tasks, with start_download and TorrentDef.load being async.

You could just make check async, which shouldn't be a problem since it's being run by the TaskManager.

@qstokkink qstokkink changed the title READY: Added watch folder again Added watch folder again Dec 5, 2024
@qstokkink
Copy link
Contributor Author

Ah! That's the missing link. I never once thought about making check async.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

WatchFolder settings missing in new version 8.0.5
2 participants