1
0
Fork 0

Do not use Object.create when applying delta

master
Austin Schaffer 2019-12-20 11:20:27 -05:00
commit b48a9f0de2
4 changed files with 11 additions and 4 deletions

View File

@ -201,14 +201,14 @@ export class DeltaProcessor
if ( delta.type === this.DELTA_DATA )
{
bucket_state = applyDelta(
Object.create( bucket_state ),
bucket_state,
deltas[ i ].data,
);
}
else
{
ratedata_state = applyDelta(
Object.create( ratedata_state ),
ratedata_state,
deltas[ i ].data,
);
}

View File

@ -103,11 +103,12 @@ export class V1MessageWriter implements MessageWriter
const event_id = this.DELTA_MAP[ delta.type ];
const start_date_ms = { "long": meta.startDate * 1000 };
const last_update_ms = { "long": meta.lastUpdate * 1000 };
const ts_ms = ts * 1000;
return {
event: {
id: event_id,
ts: ts,
ts: ts_ms,
actor: 'SERVER',
step: null,
},

View File

@ -63,6 +63,7 @@ describe( 'system.DeltaProcessor', () =>
lastUpdate: 123123123,
data: {
bar: [ 'initial and unchanged' ],
foo: [ 'third' ],
state: [ 'a', 'b', 'c', 'd' ],
},
@ -126,6 +127,7 @@ describe( 'system.DeltaProcessor', () =>
state: [ undefined, null ],
},
bucket: {
bar: [ 'initial and unchanged' ],
foo: [ 'first' ],
state: [ 'a', 'b' ],
},
@ -140,6 +142,7 @@ describe( 'system.DeltaProcessor', () =>
state: [ undefined, null ],
},
bucket: {
bar: [ 'initial and unchanged' ],
foo: [ 'first' ],
state: [ 'a', 'b' ],
},
@ -157,6 +160,7 @@ describe( 'system.DeltaProcessor', () =>
state: [ undefined, undefined, null ],
},
bucket: {
bar: [ 'initial and unchanged' ],
foo: [ 'second' ],
state: [ 'a', 'b', 'c' ],
},
@ -171,6 +175,7 @@ describe( 'system.DeltaProcessor', () =>
state: [ undefined, undefined, null ],
},
bucket: {
bar: [ 'initial and unchanged' ],
foo: [ 'second' ],
state: [ 'a', 'b', 'c' ],
},
@ -188,6 +193,7 @@ describe( 'system.DeltaProcessor', () =>
state: [ undefined, undefined, undefined, null ],
},
bucket: {
bar: [ 'initial and unchanged' ],
foo: [ 'third' ],
state: [ 'a', 'b', 'c', 'd' ],
},

View File

@ -404,7 +404,7 @@ describe( 'system.V1MessageWriter', () =>
const expected = {
event: {
id: 'STEP_SAVE',
ts: ts,
ts: ts * 1000,
actor: 'SERVER',
step: null,
},