Commit 45d22b7e authored by tobinski's avatar tobinski
Browse files

Add some debug flags

parent 505aa6a2
Pipeline #3369 canceled with stage
in 26 seconds
......@@ -182,11 +182,16 @@ export class ApiController {
async function waitForResponse(data: InterfaceStreamAppResponse) {
// if we fail to resolve the url to a provider we will send a 500
try {
console.log("Try to add data");
await responseData.add(data);
console.log("data added");
} catch (error) {
return next(Boom.internal('Unable to resolve urls to provider'));
}
console.log("tmp data");
console.log(responseData.getData());
if (responseData.finished()) {
console.log("finished");
// set the cache each time we got new data and have at least a minimum set
KafkaCache.set(id, responseData.getData());
if(!answered) {
......
......@@ -55,6 +55,7 @@ export class ResponseCollector {
if(this.config.indexOf(data.name) > -1){
// check if array
if(Array.isArray(data.data.links)) {
console.log('links');
data.data.links = await Promise.all(data.data.links.map(async (d) => {
const a = {};
try {
......@@ -67,6 +68,7 @@ export class ResponseCollector {
return a;
}
}));
console.log(data.data.links);
}
if(Array.isArray(this.finalData.data[data.name])) {
this.finalData.data[data.name].push(data.data);
......@@ -109,3 +111,6 @@ export class ResponseCollector {
return this.finalData;
}
}
export class InterfaceResponseConfig {
}
\ No newline at end of file
......@@ -22,9 +22,7 @@ describe('Test response collector', () => {
});
it('Should fail on one of two required answers', (done) => {
const config: InterfaceResponseConfig = {
data: ['resolverneo4j', 'resolverelasticseatch',],
};
const config = ['resolverneo4j', 'resolverelasticseatch',];
const collector = new ResponseCollector(config);
collector.add({name: 'neo4jresolver', data: {test}, id: 'swe34rfdedw3s'});
......@@ -33,9 +31,7 @@ describe('Test response collector', () => {
});
it('Should pass on two of two required answers', (done) => {
const config: InterfaceResponseConfig = {
data: ['resolverneo4j', 'resolverelasticsearch',],
};
const config = ['resolverneo4j', 'resolverelasticseatch',];
const collector = new ResponseCollector(config);
collector.add({name: 'resolverneo4j', data: {test}, id: 'swe34rfdedw3s'});
......@@ -45,9 +41,7 @@ describe('Test response collector', () => {
});
it('Should pass on tree of minimum two required answers', (done) => {
const config: InterfaceResponseConfig = {
data: ['resolverneo4j', 'resolverelasticsearch',],
};
const config = ['resolverneo4j', 'resolverelasticseatch',];
const collector = new ResponseCollector(config);
collector.add({name: 'resolverneo4j', data: {test}, id: 'swe34rfdedw3s'});
......@@ -57,10 +51,7 @@ describe('Test response collector', () => {
});
it('Get data from collector', (done) => {
const config: InterfaceResponseConfig = {
data: ['resolverneo4j', 'resolverelasticsearch',],
metadata: 'resolvermetadata',
};
const config = ['resolverneo4j', 'resolverelasticsearch', 'resolvermetadata'];
const mockAnswer = {
config: {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment