@Lvc, Below is the client code (AngularJS) used.
==============
$scope.getInitialData = function() {
if (window.appInitialized) {
return;
}
window.appInitialized = true;
// Get all businesses of logged-in user
url =
$scope.getAbsoluteBackendURL('function/fsdb/getbusinessesofmerchant');
$http.get(url)
.success(function(data, status) {
if ((status == "200") && (data.result.length) &&
(data.result.length > 0)) {
data.result = cleanJSON(data.result);
$scope.businesses = data.result;
} else {
$scope.businesses = [];
}
})
.error($scope.ajaxErrorHandler);
// Get all products of logged-in user
url =
$scope.getAbsoluteBackendURL('function/fsdb/getproductsofmerchant');
$http.get(url)
.success(function(data, status) {
if ((status == "200") && (data.result.length) &&
(data.result.length > 0)) {
data.result = cleanJSON(data.result);
$scope.products = data.result;
} else {
$scope.products = [];
}
})
.error($scope.ajaxErrorHandler);
// Get all base products in DB, across all vendors.
url =
$scope.getAbsoluteBackendURL('function/fsdb/getallbaseproducts');
$http.get(url)
.success(function(data, status) {
if ((status == "200") && (data.result.length) &&
(data.result.length > 0)) {
data.result = cleanJSON(data.result);
$scope.baseProducts = data.result;
} else {
$scope.baseProducts = [];
}
})
.error($scope.ajaxErrorHandler);
// Get all master countries
url = $scope.getAbsoluteBackendURL('function/fsdb/getallcountries');
$http.get(url)
.success(function(data, status) {
if ((status == "200") && (data.result.length) &&
(data.result.length > 0)) {
data.result = cleanJSON(data.result);
$scope.masterCountries = data.result;
alert("No. of Countries - "+data.result.length);
} else {
$scope.masterCountries = [];
}
})
.error($scope.ajaxErrorHandler);
};
==============
On server end, the called functions are simple function that return records
based on some select query. Below is one example:
=========================
// Returns business listing of currently logged-in merchant
user = request.getUser();
if (user) {
var businesses = db.query("SELECT FROM business WHERE user.name = ?",
user);
return businesses;
}
return [];
=========================
I hope it will help you to reproduce the issue.
Regards,
Gaurav
On Tuesday, March 18, 2014 8:12:34 PM UTC+5:30, Lvc@ wrote:
>
> Hi,
> Server side functions are multi-thread. How can I reproduce this behavior?
>
> Lvc@
>
>
> On 18 March 2014 15:27, Gaurav Dhiman <[email protected]
> <javascript:>>wrote:
>
>> During initializing my app , I do some simultaneous async HTTP/REST
>> access to OrientDB.
>> It leads to below behavior.
>>
>> First HTTP/REST call succeed, all others return with 401 HTTP error.
>> Later if I do the same calls through browser, they all succeed.
>>
>> Why can not we access OrientDB multiple times at same time ? I am using
>> server defined function to access OrientDB over HTTP/REST.
>>
>> Attached is the screenshot of chrome debugger.
>>
>> Regards,
>> Gaurav
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "OrientDB" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.