shared-store
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -0,1 +1,7 @@ | ||
### 3.1.0 | ||
* Allow skipping all tmp files - **[@jkrems](https://github.com/jkrems)** [#39](https://github.com/groupon/shared-store/pull/39) | ||
- [`ebf18c1`](https://github.com/groupon/shared-store/commit/ebf18c1d39172d5710f8edc84d6e2f9cdd2841c2) **feat:** Allow skipping all tmp files | ||
### 3.0.0 | ||
@@ -2,0 +8,0 @@ |
@@ -157,3 +157,3 @@ | ||
activeLoader = function(meta, loader, tmpDir) { | ||
activeLoader = function(meta, loader, tmpDir, writeCacheFiles) { | ||
var data, fromCache, onDataLoaded, rawData, ref1, tearDownCrashHandler; | ||
@@ -164,2 +164,9 @@ rawData = meta.flatMapLatest(loader).map(function(otherData) { | ||
}); | ||
if (!writeCacheFiles) { | ||
debug('skip writing a cache, returning raw data stream'); | ||
return rawData.distinctUntilChanged(property('data'), isEqual).publish(); | ||
} | ||
debug('wrapping data stream in cache', { | ||
tmpDir: tmpDir | ||
}); | ||
ref1 = crashRecovery(tmpDir), onDataLoaded = ref1.onDataLoaded, tearDownCrashHandler = ref1.tearDownCrashHandler; | ||
@@ -175,5 +182,8 @@ data = rawData.tap(onDataLoaded, tearDownCrashHandler, tearDownCrashHandler); | ||
this.cachedLoader = function(meta, loader, tmpDir, active) { | ||
this.cachedLoader = function(meta, loader, tmpDir, active, writeCacheFiles) { | ||
if (writeCacheFiles == null) { | ||
writeCacheFiles = true; | ||
} | ||
debug('cachedLoader(%j)', active); | ||
loader = active ? activeLoader(meta, loader, tmpDir) : passiveLoader(tmpDir); | ||
loader = active ? activeLoader(meta, loader, tmpDir, writeCacheFiles) : passiveLoader(tmpDir); | ||
return Observable.create(function(observer) { | ||
@@ -180,0 +190,0 @@ loader.subscribe(observer); |
@@ -95,3 +95,3 @@ | ||
meta = _this._createMeta(); | ||
_this.stream = cachedLoader(meta, loader, _this._temp, _this._active); | ||
_this.stream = cachedLoader(meta, loader, _this._temp, _this._active, _this._writeCacheFiles); | ||
return _this.subscription = _this.stream.subscribe(_this._handleUpdate, _this._handleError); | ||
@@ -103,7 +103,14 @@ }; | ||
this._cache = null; | ||
this._writeCacheFiles = !!this._active; | ||
this._retryTimeout = TEN_SECONDS; | ||
} | ||
SharedStore.prototype.setActive = function(_active) { | ||
this._active = _active != null ? _active : true; | ||
SharedStore.prototype.setActive = function(isActive) { | ||
if (isActive == null) { | ||
isActive = true; | ||
} | ||
this._active = !!isActive; | ||
if (isActive && typeof isActive.writeCacheFiles === 'boolean') { | ||
this._writeCacheFiles = isActive.writeCacheFiles; | ||
} | ||
return this._createStream(); | ||
@@ -110,0 +117,0 @@ }; |
{ | ||
"name": "shared-store", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Keeping config data in sync", | ||
@@ -5,0 +5,0 @@ "license": "BSD-3-Clause", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64662
1196