You are here: Web Apps with Visual LANSA > 20. Tips and Techniques > 20.3 Asynchronous vs Synchronous Database Access > 20.3.1 Synchronous Processing

20.3.1 Synchronous Processing

Synchronous requests stop all processing in the browser while the request is being handled. This means the user is unable to do anything further while the request is processing and may have a significant impact on response times is large amounts of data are being processed or complex routines are executed on the application server.

From a coding perspective synchronous requests are simpler to code as there is no need to handle situations where the user has moved to a different part of the application while waiting for a server response.

JavaScript executes in a single thread meaning that the browser User Interface will not change until processing completes. Consider this block of code.

 

Evtroutine Handling(#List.ItemGotFocus)
 
   #Details.visible := False
   #GetData.Execute(#Data)
   #Details.visible := True
 
Endroutine
 

When the event fires, you might expect #Details to disappear from view, but the synchronous nature of the processing means that the property will be set to false and then set back to true before the User Interface has a chance to update.

It is also worth noting that mouse clicks that occur while the User Interface is locked will be processed when the current set of processing completes.