Here is my environment:
Here is the thing: when the index page loads, two ajax requests will be sent:
var xhr1 = $.ajax({
url: '/a',
'dataType': 'json'
'success': function(){}
);
xhr1.done(function(){...})
var xhr2 = $.ajax({
url: '/b',
'dataType': 'json'
'success': function(){}
);
xhr2.done(function(){...})
both of then will query Mongodb, like this:
app.get('/a', functionA);
app.get('/b', functionB);
functionA = function() {
var collectionA = new mongodb.Collection(client, 'a');
collectionA.find().toArray(function(err, arrayA){
var collectionB = new mongodb.Collection(client, 'b');
collectionB.find().toArray(function(err, ArrayB) {
});
});
}
functionA = function() {
var collectionB = new mongodb.Collection(client, 'b');
collectionB.find().toArray(function(err, arrayB){
});
}
collectionB in two requests are the same collection
each time, one request(1st or 2nd) was suspended, no response, no error. from the logs, I can see that request was stuck at the find() method. what's wired is after about two minutes, the page sent the same request again(I guess JQuery did that), then got the response.
in these two request, no redis request.
is it because mongodb? concurrent problem?