Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post taking ~120000ms #91

Open
ankitladhania opened this issue May 24, 2014 · 1 comment
Open

Post taking ~120000ms #91

ankitladhania opened this issue May 24, 2014 · 1 comment

Comments

@ankitladhania
Copy link

screenshot from 2014-05-24 10 54 07
I dont know what is happening sometimes cassandra is easily committing the post and storing data in ~20ms and other times the post takes ~120000ms but the post is not committed(i.e stored). Any Suggestion Guys i'm struggling with this for two days
I dont find any error in the bellow queries . I have indexed checked column.

  var queries={
insert:{
    sport_detail:{
        query:'INSERT INTO only_sport_detail(sportid,sport_name,sport_short_name,time_made,checked) VALUES (?,?,?,?,?)'
    },
    league_detail:{
        query:'INSERT INTO only_league_detail(leagueid,league_name,league_short_name,league_abbreviation,league_location,time_made,checked) VALUES (?,?,?,?,?,?,?)'
    }
},
retrieve:{
    sport_detail:{
        query:'SELECT * FROM only_sport_detail WHERE checked=?'
    },
    league_detail:{
        query:'SELECT * FROM only_league_detail WHERE checked=?'
    }
}
 };

   module.exports=function(app,cassandraConfig){
var cassandraClient=cassandraConfig.cassandraClient;
var writeConsistency=cassandraConfig.writeConsistency;
var readConsistency=cassandraConfig,readConsistency;
var cassandra=cassandraConfig.cassandra;
app.get('/insert/detail/sport',function(req,res){
    res.sendfile('views/insert/sport_detail.html');
});
app.post('/insert/detail/sport',function(req,res){
    sportid=cassandra.types.timeuuid();
    cassandraClient.executeAsPrepared(
        queries.insert.sport_detail.query,
        [sportid,req.body.sport_name,req.body.sport_short_name,{value: new Date(), hint: cassandra.types.dataTypes.timestamp},1],
        writeConsistency,
        function(err){
            if(!err)
            {

                cassandraClient.executeAsPrepared(
                    queries.retrieve.sport_detail.query,
                    [1],
                    function(err,result){
                        if(err)
                        {
                            console.log(err);
                            res.send('Sorry error');
                            res.end();
                        }
                        else
                        {
                            res.json(result.rows);
                            res.end();
                        }
                    }
                );
            }
        }
    );

});

app.get('/get/detail/sport',function(req,res){
    cassandraClient.executeAsPrepared(
        queries.retrieve.sport_detail.query,
        [1],
        function(err,result){
            if(err)
            {
                console.log(err);
                res.send('Sorry error');
                res.end();
            }
            else
            {
                res.json(result.rows);
                res.end();
            }
        }
    );
});

};

@jorgebay
Copy link
Owner

I would recommend to try to isolate the problem by:

  • Adding logging using the client log event.
  • Making a small app without express to see where the problem actually is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants