diff --git a/src/js/model/frame/AsyncCachedFrameProcessor.js b/src/js/model/frame/AsyncCachedFrameProcessor.js index 50f5913a..c3465947 100644 --- a/src/js/model/frame/AsyncCachedFrameProcessor.js +++ b/src/js/model/frame/AsyncCachedFrameProcessor.js @@ -23,6 +23,8 @@ this.cache_[namespace] = {}; } + var deferred = Q.defer(); + var cache = this.cache_[namespace]; var firstCacheKey = frame.getHash(); @@ -35,21 +37,20 @@ processedFrame = this.outputCloner(cache[secondCacheKey], frame); cache[firstCacheKey] = processedFrame; } else { - var deferred = Q.defer(); this.frameProcessor(frame, this.onFrameProcessorComplete.bind(this, deferred, cache, firstCacheKey, secondCacheKey)); - return deferred.promise; } } if (processedFrame) { - return Q.fcall(processedFrame); + deferred.resolve(processedFrame); } + + return deferred.promise; }; ns.AsyncCachedFrameProcessor.prototype.onFrameProcessorComplete = function (deferred, cache, firstCacheKey, secondCacheKey, processedFrame) { cache[secondCacheKey] = processedFrame; cache[firstCacheKey] = processedFrame; - console.log('RESOLVING'); deferred.resolve(processedFrame); } })(); \ No newline at end of file diff --git a/src/js/service/CurrentColorsService.js b/src/js/service/CurrentColorsService.js index 7126f365..f808172a 100644 --- a/src/js/service/CurrentColorsService.js +++ b/src/js/service/CurrentColorsService.js @@ -58,8 +58,6 @@ return this.cachedFrameProcessor.get(frame); }.bind(this)) ).done(function (results) { - console.log('ALL DONE'); - var colors = {}; results.forEach(function (result) { Object.keys(result).forEach(function (color) {