Skip to content

Commit 31e6702

Browse files
Merge pull request #9255 from liranmauda/liran-backport-into-5.20
[Backport into 5.20] Added a fix for namespace bucket caching while upload
2 parents 74cd74f + bdd2824 commit 31e6702

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/sdk/namespace_cache.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ class NamespaceCache {
664664
source_stream: cache_stream,
665665
async_get_last_modified_time: async () => {
666666
const upload_res = await hub_promise;
667-
const last_modified_time = (new Date(upload_res.last_modified_time)).getTime();
667+
const last_modified_time = (new Date(upload_res.date)).getTime();
668668
if (isNaN(last_modified_time)) {
669669
throw new Error('Invalid last_modified_time returned from hub_promise, Expected a valid date or timestamp.');
670670
}

src/test/unit_tests/internal/test_namespace_cache.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ class MockNamespace {
276276
if (this._write_err) {
277277
// Simulate success in the case that the error is caused by other stream
278278
console.log(`${this.type} mock: write err bucket ${params.bucket} key ${params.key}`);
279-
resolve({ etag, last_modified_time: create_time });
279+
resolve({ etag, date: create_time });
280280
return;
281281
}
282282

@@ -296,7 +296,7 @@ class MockNamespace {
296296
buf: this._buf,
297297
size: params.size,
298298
});
299-
resolve({ etag, last_modified_time: create_time });
299+
resolve({ etag, date: create_time });
300300
});
301301
params.source_stream.on('finish', async () => {
302302
console.log(`${this.type} mock: got finish in upload_object: bucket ${params.bucket} key ${params.key}`, recv_buf);
@@ -434,7 +434,7 @@ mocha.describe('namespace caching: upload scenarios', () => {
434434
return !_.isUndefined(cache_obj_create_time);
435435
}, 5000);
436436
const cache_obj = cache.get_obj(bucket, key);
437-
assert(cache_obj.create_time === ret.last_modified_time);
437+
assert(cache_obj.create_time === ret.date);
438438
});
439439

440440
mocha.it('hub upload failure: object not cached', async () => {

0 commit comments

Comments
 (0)