Getting really often the error code 15000

I use an Server Code Event Handler to calculate the max number of a column and set the number of the object to be added to the next higher number. This works but I get really often the error code 15000 which indicates that the 5 seconds of processing time were not sufficient to run the event handler and it was canceled and an Exception was thrown.
This is my code:

 public void beforeCreate( RunnerContext context, Point point) throws Exception
 { 
 BackendlessDataQuery maxNumQuery = new BackendlessDataQuery();
 maxNumQuery.setWhereClause("groupId = '" + point.getGroupId() + "'");
 maxNumQuery.setPageSize(1);
 
 QueryOptions queryOptions = new QueryOptions(); 
 queryOptions.addSortByOption( "number DESC" );
 
 maxNumQuery.setQueryOptions( queryOptions );
 BackendlessCollection<Point> points = Point.find(maxNumQuery);
 
 int nextNum = -1;
 if(! points.getCurrentPage().isEmpty()) {
  nextNum = points.getCurrentPage().get(0).getNumber() + 1;
 } 
 if(nextNum != -1)
 point.setNumber(nextNum);
 
 point.setIsNew(false);
 } 

I have an index on “number” and “groupId”, so the query should run fast actually. What could be the problem? I have only 2000 records in the Points table.

Did you check how much time it takes for the code to run with debug code runner?

In debug it took 1.3 seconds.

Please provide us with your application id and cURL request reproducing the timeout issue.

I am not familiar with cURL and since the request producing the timeout is adding data to the production environment, I don’t think this is a way to go anyway.

And the timeout arises not all the time. To me it looks like on peek times of the Backendless service it hits the 5 seconds execution time. I don’t think this is a bug.

So I guess my question is: Is there a way to improve my Event Trigger to make it faster or is there another way to go here?

We’ve been having issues with the system which slow down the service and some calls might be timing out. It may be the cause of the error you’re seeing. Have you experienced any errors today?

I just tried it and I got a timeout. My app uses a local DB and uses the Backendless service only to sync the data between devices every now and then. And sometimes, like today, the sync process times out.

Hi Juergen,

We have made quite a bit of changes to make sure the timeout problem goes away. The service has been running very smoothly since then. What has your observation been like?

Regards,
Mark

I just tried it 2 times and after a while I got each time a

unexpected end of stream on connection {api.backendless.com:443

Could you please show the complete error? What is the code doing when it occurred?

Currently I can’t reproduce the error. It were something about

https cipher

but I can’t recall any more. Sorry.