diff --git a/CHANGELOG.md b/CHANGELOG.md index 06cbde2e3..bab6d9290 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). Use the following format for additions: ` - VERSION: [feature/patch (if applicable)] Short description of change. Links to relevant issues/PRs.` +- 1.1.9: Fix around ubuntu's inability to cache promises. [#877](https://github.com/FredrikNoren/ungit/pull/878) - 1.1.8: - Realtime text diff via invalidate diff on directory change [#867](https://github.com/FredrikNoren/ungit/pull/867) - Promisify `./source/utils/cache.js` [#870](https://github.com/FredrikNoren/ungit/pull/870) diff --git a/package.json b/package.json index 7aa6d41bf..cbf62458b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "ungit", "author": "Fredrik Norén ", "description": "Git made easy", - "version": "1.1.8", + "version": "1.1.9", "ungitPluginApiVersion": "0.2.0", "scripts": { "start": "node ./bin/ungit", diff --git a/source/utils/cache.js b/source/utils/cache.js index 36b9d89a4..2cf805ea7 100644 --- a/source/utils/cache.js +++ b/source/utils/cache.js @@ -15,8 +15,11 @@ cache.resolveFunc = (key) => { .catch({ errorcode: "ENOTFOUND" }, (e) => { if (!funcMap[key]) throw e; // func associated with key is not found, throw not found error const result = funcMap[key].func(); // func is found, resolve, set with TTL and return result - return cache.setAsync(key, result, funcMap[key].ttl) - .then(() => { return result }); + return (result.then ? result : Bluebird.resolve(result)) + .then((r) => { + return cache.setAsync(key, r, funcMap[key].ttl) + .then(() => { return r; }) + }); }); }