@luvio/environments 0.69.0 → 0.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -375,9 +375,6 @@ function isStoreEntryError(storeRecord) {
|
|
|
375
375
|
return storeRecord.__type === 'error';
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
-
function isStoreEntryExpiredAndError(storeRecord, expirationTimestamp, now) {
|
|
379
|
-
return isStoreEntryError(storeRecord) && expirationTimestamp < now;
|
|
380
|
-
}
|
|
381
378
|
/**
|
|
382
379
|
* Takes a set of entries from DurableStore and publishes them via the passed in funcs.
|
|
383
380
|
* This respects expiration and checks for valid DurableStore data shapes. This should
|
|
@@ -400,7 +397,6 @@ function publishDurableStoreEntries(durableRecords, publish, publishMetadata) {
|
|
|
400
397
|
// no records to revive
|
|
401
398
|
return { revivedKeys, hadUnexpectedShape };
|
|
402
399
|
}
|
|
403
|
-
const now = Date.now();
|
|
404
400
|
for (let i = 0, len = durableKeys.length; i < len; i += 1) {
|
|
405
401
|
const key = durableKeys[i];
|
|
406
402
|
const durableRecord = durableRecords[key];
|
|
@@ -416,27 +412,12 @@ function publishDurableStoreEntries(durableRecords, publish, publishMetadata) {
|
|
|
416
412
|
continue;
|
|
417
413
|
}
|
|
418
414
|
if (metadata !== undefined) {
|
|
419
|
-
const { expirationTimestamp
|
|
415
|
+
const { expirationTimestamp } = metadata;
|
|
420
416
|
if (expirationTimestamp === undefined) {
|
|
421
417
|
// if unexpected expiration data skip reviving
|
|
422
418
|
hadUnexpectedShape = true;
|
|
423
419
|
continue;
|
|
424
420
|
}
|
|
425
|
-
// if past stale TTL then don't revive
|
|
426
|
-
if (staleTimestamp !== undefined && staleTimestamp < now) {
|
|
427
|
-
continue;
|
|
428
|
-
}
|
|
429
|
-
// We don't want to revive a cached value if it's an error and it's
|
|
430
|
-
// expirationTimestamp TTL is expired, otherwise we would never hit the network
|
|
431
|
-
// during resolveSnapshot or rebuildSnapshot because the way the Reader works.
|
|
432
|
-
// If a StoreEntry is an error, the Reader will return UnfulfilledSnapshot
|
|
433
|
-
// if stale TTL is expired. But it will return ErrorSnapshot (instead of
|
|
434
|
-
// StaleSnapshot) if expirationTimestamp TTL is expired (but stale TTL isn't).
|
|
435
|
-
// In our environment the stale TTL is maxed out so Reader will always
|
|
436
|
-
// return ErrorSnapshot.
|
|
437
|
-
if (isStoreEntryExpiredAndError(data, expirationTimestamp, now)) {
|
|
438
|
-
continue;
|
|
439
|
-
}
|
|
440
421
|
publishMetadata(key, metadata);
|
|
441
422
|
}
|
|
442
423
|
if (isStoreEntryError(data)) {
|
|
@@ -379,9 +379,6 @@
|
|
|
379
379
|
return storeRecord.__type === 'error';
|
|
380
380
|
}
|
|
381
381
|
|
|
382
|
-
function isStoreEntryExpiredAndError(storeRecord, expirationTimestamp, now) {
|
|
383
|
-
return isStoreEntryError(storeRecord) && expirationTimestamp < now;
|
|
384
|
-
}
|
|
385
382
|
/**
|
|
386
383
|
* Takes a set of entries from DurableStore and publishes them via the passed in funcs.
|
|
387
384
|
* This respects expiration and checks for valid DurableStore data shapes. This should
|
|
@@ -404,7 +401,6 @@
|
|
|
404
401
|
// no records to revive
|
|
405
402
|
return { revivedKeys, hadUnexpectedShape };
|
|
406
403
|
}
|
|
407
|
-
const now = Date.now();
|
|
408
404
|
for (let i = 0, len = durableKeys.length; i < len; i += 1) {
|
|
409
405
|
const key = durableKeys[i];
|
|
410
406
|
const durableRecord = durableRecords[key];
|
|
@@ -420,27 +416,12 @@
|
|
|
420
416
|
continue;
|
|
421
417
|
}
|
|
422
418
|
if (metadata !== undefined) {
|
|
423
|
-
const { expirationTimestamp
|
|
419
|
+
const { expirationTimestamp } = metadata;
|
|
424
420
|
if (expirationTimestamp === undefined) {
|
|
425
421
|
// if unexpected expiration data skip reviving
|
|
426
422
|
hadUnexpectedShape = true;
|
|
427
423
|
continue;
|
|
428
424
|
}
|
|
429
|
-
// if past stale TTL then don't revive
|
|
430
|
-
if (staleTimestamp !== undefined && staleTimestamp < now) {
|
|
431
|
-
continue;
|
|
432
|
-
}
|
|
433
|
-
// We don't want to revive a cached value if it's an error and it's
|
|
434
|
-
// expirationTimestamp TTL is expired, otherwise we would never hit the network
|
|
435
|
-
// during resolveSnapshot or rebuildSnapshot because the way the Reader works.
|
|
436
|
-
// If a StoreEntry is an error, the Reader will return UnfulfilledSnapshot
|
|
437
|
-
// if stale TTL is expired. But it will return ErrorSnapshot (instead of
|
|
438
|
-
// StaleSnapshot) if expirationTimestamp TTL is expired (but stale TTL isn't).
|
|
439
|
-
// In our environment the stale TTL is maxed out so Reader will always
|
|
440
|
-
// return ErrorSnapshot.
|
|
441
|
-
if (isStoreEntryExpiredAndError(data, expirationTimestamp, now)) {
|
|
442
|
-
continue;
|
|
443
|
-
}
|
|
444
425
|
publishMetadata(key, metadata);
|
|
445
426
|
}
|
|
446
427
|
if (isStoreEntryError(data)) {
|
|
@@ -414,9 +414,6 @@
|
|
|
414
414
|
return storeRecord.__type === 'error';
|
|
415
415
|
}
|
|
416
416
|
|
|
417
|
-
function isStoreEntryExpiredAndError(storeRecord, expirationTimestamp, now) {
|
|
418
|
-
return isStoreEntryError(storeRecord) && expirationTimestamp < now;
|
|
419
|
-
}
|
|
420
417
|
/**
|
|
421
418
|
* Takes a set of entries from DurableStore and publishes them via the passed in funcs.
|
|
422
419
|
* This respects expiration and checks for valid DurableStore data shapes. This should
|
|
@@ -439,7 +436,6 @@
|
|
|
439
436
|
// no records to revive
|
|
440
437
|
return { revivedKeys: revivedKeys, hadUnexpectedShape: hadUnexpectedShape };
|
|
441
438
|
}
|
|
442
|
-
var now = Date.now();
|
|
443
439
|
for (var i = 0, len = durableKeys.length; i < len; i += 1) {
|
|
444
440
|
var key = durableKeys[i];
|
|
445
441
|
var durableRecord = durableRecords[key];
|
|
@@ -455,27 +451,12 @@
|
|
|
455
451
|
continue;
|
|
456
452
|
}
|
|
457
453
|
if (metadata !== undefined) {
|
|
458
|
-
var expirationTimestamp = metadata.expirationTimestamp
|
|
454
|
+
var expirationTimestamp = metadata.expirationTimestamp;
|
|
459
455
|
if (expirationTimestamp === undefined) {
|
|
460
456
|
// if unexpected expiration data skip reviving
|
|
461
457
|
hadUnexpectedShape = true;
|
|
462
458
|
continue;
|
|
463
459
|
}
|
|
464
|
-
// if past stale TTL then don't revive
|
|
465
|
-
if (staleTimestamp !== undefined && staleTimestamp < now) {
|
|
466
|
-
continue;
|
|
467
|
-
}
|
|
468
|
-
// We don't want to revive a cached value if it's an error and it's
|
|
469
|
-
// expirationTimestamp TTL is expired, otherwise we would never hit the network
|
|
470
|
-
// during resolveSnapshot or rebuildSnapshot because the way the Reader works.
|
|
471
|
-
// If a StoreEntry is an error, the Reader will return UnfulfilledSnapshot
|
|
472
|
-
// if stale TTL is expired. But it will return ErrorSnapshot (instead of
|
|
473
|
-
// StaleSnapshot) if expirationTimestamp TTL is expired (but stale TTL isn't).
|
|
474
|
-
// In our environment the stale TTL is maxed out so Reader will always
|
|
475
|
-
// return ErrorSnapshot.
|
|
476
|
-
if (isStoreEntryExpiredAndError(data, expirationTimestamp, now)) {
|
|
477
|
-
continue;
|
|
478
|
-
}
|
|
479
460
|
publishMetadata(key, metadata);
|
|
480
461
|
}
|
|
481
462
|
if (isStoreEntryError(data)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luvio/environments",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.70.0",
|
|
4
4
|
"description": "Luvio Environments",
|
|
5
5
|
"main": "dist/umd/es2018/environments.js",
|
|
6
6
|
"module": "dist/es/es2018/environments.js",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
"dist/"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@luvio/engine": "0.
|
|
29
|
+
"@luvio/engine": "0.70.0"
|
|
30
30
|
}
|
|
31
31
|
}
|