Skip to content

Synchronize feed updates

Timofey requested to merge holykol/podcasts:synchronize-feed-updates into master

Problem

App crashed when user initiated multiple feed updates. This was caused by swapping window.updater instance which owned the receiver part of update thread channel. Sending to that channel later caused a panic because receiver was already dropped.

Solution:

  • Send update sources instead of spawning update thread directly

  • Simplify refresh_feed and refresh (now schedule_refresh) function signatures because dyn traits are hard. I have plans to simplify it even further in later MR's.

Other ways to solve this are:

  1. Rely on channels as callback mechanism for notifying when the previous update is done.

  2. Use futures.
    Seems like a good fit for that king of asynchronous job. See https://coaxion.net/blog/2018/04/glib-gio-async-operations-and-rust-futures-async-await/

Resolves #166 (closed)

Disclaimer: I'm pretty new to Rust and Gtk so please tell me if there is more idiomatic way to get things done.

Merge request reports