Fix/improve syncing
Syncing isn't very user friendly and is quite hacky. That's because we reuse Provider's
interface for fetching articles, but we should provide a separate one, working in background.
So, there should be several improvements done:
-
New function should be introduced, which should work in a similar manner as Provider._get_articles_cf
andProvider._get_feeds_cf
, but shouldn't automatically switch to offline mode and its callback should be called without any arguments, both on error and normal callback from async process pool. -
Sync's timeout should be extended (like tripled, hardcoded to some high value or even always set to infinity); CommaFeed is very slow answering consecutive non-cached requests. -
Normal requests (like refresh, feed/articles fetch) should be prioritized over a sync (is it possible to configure multiprocessing.Pool
that way? Maybe we'll need additional priority queue inProvider
?) -
sync should be either configurable to auto spawn or (better) user should be able to run it without running FeedCommas UI (via e.g. $ feed-commas --sync
). I guess that when run this way, sync should have infinite timeout and disregard offline mode in config: this would allow writing e.g. cron jobs:
@daily timeout 5m feed-commas --sync
-
sync should be a two-way thing. FeedCommas should remember user actions taken in offline mode (marking read, starring, ...) and send them to CommaFeed during sync. There could even be some kind of "small sync": when switching from offline to online mode, these changes should be synchronized automatically with CommaFeed. NOTE: these can't be simply stored as URLs needed to be sent, because of POSTs and client's
interface complications. We need to store actions' arguments somehow (maybe just pickle kwargs dict and store it as a blob?)