From d49b1b2456735ac23e2a2c7a2298eaff666c773f Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Thu, 28 Jun 2012 17:02:14 +0200 Subject: [PATCH] dlight.c: Mark item in download history earlier. It is more correct to mark an item as downloaded right after it is actually fetched and not after it is successfully written to disk. --- dlight.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlight.c b/dlight.c index 204b7f0..0acf5de 100644 --- a/dlight.c +++ b/dlight.c @@ -53,14 +53,16 @@ static void process_items(rss_t rss, struct target *t) { } } - /* save file to disk. */ + /* At this point, mark the item as downloaded. + Even if we encounter an error while saving to disk. */ + dlhist_mark(item.title, filter->dest); + if (write_http_file(file, filter->dest) < 0) continue; printf("Downloaded: %s (%s) to %s\n", item.title, item.link, filter->dest); - dlhist_mark(item.title, filter->dest); proc_cache_update(item.link); }