stefanwalther/qrs

Copy app creates double apps and timeout errors

QHose opened this issue · 5 comments

QHose commented

hi Stefan,

If I use the code of NPM QRS, I get double apps, and timeout messages. If I just create my own HTTP call it works perfectly. Can you see the issue?

  1. I don' see double log entries in node, but I do have double apps in Sense...

//CODE WITH NPM QRS, THAT GENERATES DOUBLE APPS

function copyApp (guid, name) {
    console.log('Copy template: '+guid+' to new app: '+name);
    check(guid, String);
    check(name, String);
    return qrs.post('/qrs/app/'+guid+'/copy', [{"key": "name", "value": name}])
    .then(
        function fulfilled (result) {
            console.log('result of copy app promise', result);
            return result;
        },
        function Rejected (error){
            console.error('Promise Rejected: Error when trying to copy the app', error);
            throw new Meteor.Error('App copy failed', 'App copy failed');
        })
};

//MY OWN CODE THAT WORKS FINE

function copyApp (guid, name) {
    console.log('Copy template: '+guid+' to new app: '+name);
    check(guid, String);
    check(name, String);

    return new Promise(function(resolve, reject){ 
        HTTP.call( 'post', 'http://'+config.host+'/'+config.virtualProxy+'/qrs/app/'+guid+'/copy?name='+name+'&xrfkey='+config.xrfkey, 
        {
            headers: {
                'hdr-usr' : config.headerValue,
                'X-Qlik-xrfkey': config.xrfkey
            }
        }, function( error, response ) {
            if ( error ) {
                console.error( error );
                throw new Meteor.Error('error app copy', error)
                reject(error);
            } else {
                console.log( response );
                resolve('copy app success');
            }
        });
    })

};
QHose commented

Also this function creates timeouts and errors

image

function getStreams () {
    return qrs.get('/qrs/stream/full');
};

QHose commented

mmm, the QMC has also issues to delete the app... so maybe not only QRS NPM issue. (my laptop connects to the vm running sense, and my node tool also runs on the laptop)

image

now the streams have been removed, but the I get still errors from npm qrs, when I want to get my streams

image

QHose commented

So, this is caused by the fact that i don't throttle my requests to sense qrs

  1. Could you implement this limiter in your code?
QHose commented

Btw, i noticed you can seriously make sense qmc itself unresponsive by this... Even after my calls finished

I think there is some general timeout handling necessary in this, will investigate as soon as I have time ;-)