From 72918fb41be43d3dc96a42dc6c1386dff1ccee87 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Wed, 29 Apr 2015 15:54:38 +0100 Subject: [PATCH] invalidate the cache if there is an error copying a file --- services/clsi/app/coffee/UrlCache.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/clsi/app/coffee/UrlCache.coffee b/services/clsi/app/coffee/UrlCache.coffee index 153e133e2e..941bc9defd 100644 --- a/services/clsi/app/coffee/UrlCache.coffee +++ b/services/clsi/app/coffee/UrlCache.coffee @@ -10,7 +10,12 @@ module.exports = UrlCache = downloadUrlToFile: (project_id, url, destPath, lastModified, callback = (error) ->) -> UrlCache._ensureUrlIsInCache project_id, url, lastModified, (error, pathToCachedUrl) => return callback(error) if error? - UrlCache._copyFile(pathToCachedUrl, destPath, callback) + UrlCache._copyFile pathToCachedUrl, destPath, (error) -> + if error? + UrlCache._clearUrlDetails project_id, url, () -> + callback(error) + else + callback(error) clearProject: (project_id, callback = (error) ->) -> UrlCache._findAllUrlsInProject project_id, (error, urls) ->