Hi again, I’ve started to receive a lot of this error type.
I have very basic custom business logic written in JS. All it does is changing INT value to desired value and sending message to status channel:
/**
* @param {Number} status
* @returns {Promise.<void>}
*/
changeStatus(status) {
let TAG = 'EventsService.changeStatus - ';
if (status === null) {
throw new Error('Invalid Request, no status provided');
}
if (this.request.context.userId === null) {
throw new Error('Please login first!');
}
//Create UserObject
let currentUser = new Backendless.User();
currentUser.objectId = this.request.context.userId;
currentUser.online = status;
let usersStorage = Backendless.Persistence.of(Backendless.User);
return usersStorage.save(currentUser).then(function (updateUser) {
//Notify users about change
var message = updateUser.name + "is offline";
if (status === 1) {
message = updateUser.name + "is offline";
}
let channel = "Status",
pubOps = new Backendless.PublishOptions({
subtopic: "CHN-" + currentUser.objectId,
headers: {
userID: currentUser.objectId,
userName: updateUser.name,
status: status
}
}),
deliveryOptions = new Backendless.DeliveryOptions({
pushPolicy: "PUBSUB"
});
return Backendless.Messaging.publish(channel, message, pubOps, deliveryOptions)
.then(function (response) {
return updateUser;
})
.catch(function (error) {
console.error(TAG + " Publish status " + JSON.stringify(error));
throw error;
});
}).catch(function (updateErr) {
console.error(TAG + " Update currentUser " + JSON.stringify(updateErr));
throw updateErr;
});
}
But this method is failing roughly 50% of tries with error:
400 - Task execution is aborted due to timeout
OR
It works perfecly
23:31:34.773 - [5BBA19DB-773F-F004-FF5F-0F5B4257FA00] [INVOKE SERVICE] services.EventsService.changeStatus
23:31:36.000 - [5BBA19DB-773F-F004-FF5F-0F5B4257FA00] Processing finished
BUT all of this happens only in production, if there is debugging session online, it work fine in 100% of tries