1
0
Fork 0

[DEV-5312] Log quote_id along with doc_id

master
Austin Schaffer 2019-12-17 11:45:52 -05:00
parent ccfd40c64f
commit 542745da8a
6 changed files with 46 additions and 16 deletions

View File

@ -273,6 +273,7 @@ export class MongoTokenDao implements TokenDao
),
{
doc_id: doc_id,
quote_id: doc_id,
ns: ns,
}
) );
@ -318,6 +319,7 @@ export class MongoTokenDao implements TokenDao
),
{
doc_id: doc_id,
quote_id: doc_id,
ns: ns,
},
);
@ -363,6 +365,7 @@ export class MongoTokenDao implements TokenDao
),
{
doc_id: doc_id,
quote_id: doc_id,
ns: ns,
token_id: token_id,
},

View File

@ -22,6 +22,7 @@
import { DeltaDao } from '../system/db/DeltaDao';
import { DocumentMeta } from '../document/Document';
import { AmqpPublisher } from './AmqpPublisher';
import { context } from '../error/ContextError';
import { EventEmitter } from 'events';
import {
DeltaType,
@ -122,11 +123,25 @@ export class DeltaProcessor
)
.then( _ =>
{
this._emitter.emit( 'document-processed', { doc_id: meta.id } );
this._emitter.emit(
'document-processed',
{
doc_id: meta.id,
quote_id: meta.id,
},
);
} )
.catch( ( e: Error ) =>
{
this._emitter.emit( 'error', e );
const context_error = context(
e,
{
doc_id: meta.id,
quote_id: meta.id,
},
);
this._emitter.emit( 'error', context_error );
return this._dao.setErrorFlag( meta.id );
} );
}

View File

@ -84,6 +84,7 @@ export class DeltaPublisher implements AmqpPublisher
new AmqpError( 'Error sending message: No channel' ),
{
doc_id: meta.id,
quote_id: meta.id,
delta_type: delta.type,
delta_ts: delta.timestamp,
},
@ -104,6 +105,7 @@ export class DeltaPublisher implements AmqpPublisher
new Error ( 'Delta publish failed' ),
{
doc_id: meta.id,
quote_id: meta.id,
delta_type: delta.type,
delta_ts: delta.timestamp,
}
@ -115,6 +117,8 @@ export class DeltaPublisher implements AmqpPublisher
this._emitter.emit(
'delta-publish',
{
doc_id: meta.id,
quote_id: meta.id,
delta: delta,
exchange: this._conn.getExchangeName(),
}

View File

@ -134,6 +134,7 @@ export class MongoDeltaDao implements DeltaDao
new DaoError( 'Error advancing delta index: ' + e ),
{
doc_id: doc_id,
quote_id: doc_id,
type: type,
}
) );
@ -177,6 +178,7 @@ export class MongoDeltaDao implements DeltaDao
),
{
doc_id: doc_id,
quote_id: doc_id,
last_update_ts: last_update_ts,
}
) );
@ -216,6 +218,7 @@ export class MongoDeltaDao implements DeltaDao
),
{
doc_id: doc_id,
quote_id: doc_id,
}
) );
return;

View File

@ -372,6 +372,7 @@ describe( 'server.token.TokenDao', () =>
`${ns}.tok123`,
{
doc_id: did,
quote_id: did,
ns: ns,
token_id: 'tok123',
},
@ -387,6 +388,7 @@ describe( 'server.token.TokenDao', () =>
ns,
{
doc_id: did,
quote_id: did,
ns: ns,
},
],
@ -441,6 +443,7 @@ describe( 'server.token.TokenDao', () =>
ns,
{
doc_id: did,
quote_id: did,
ns: ns,
},
],
@ -455,6 +458,7 @@ describe( 'server.token.TokenDao', () =>
ns,
{
doc_id: did,
quote_id: did,
ns: ns,
},
],

View File

@ -123,6 +123,7 @@ describe( 'server.DeltaPublisher', () =>
const expected = {
doc_id: meta.id,
quote_id: meta.id,
delta_type: delta.type,
delta_ts: delta.timestamp
}