General information
Title:
How do you best handle error 1541: 'Connection is busy'
The approach I have taken in the past is to trap this error in a global error handler and issue a RETRY. Roughly like this:
* Trap for "connection busy" errors
=INKEY( 0.1 ) && Keep the RETRYs down to reasonable level
DOEVENTS && Allow the view tying up the connection to continue downloading
WAIT WINDOW NOWAIT 'Requerying, please wait'
RETRY
A serious problem with this approach is that raising events with the DOEVENTS call can sometimes cause the RETRY to fail. For example, if Activate code were to be run in the error trap, and the Activate code changed the alias, the REQUERY() would run against the wrong alias.
The basic problem seems to be that the error handler should never change the state of the program, but this can easily happen whenever event processing occurs while in the error state.
I am considering a busy check before the REQUERY() to eliminate this problem. Roughly, something like this:
lnConnectionHandle = CURSORGETPROP( 'ConnectHandle', tcAlias )
DO WHILE SQLGETPROP( lnConnectionHandle, 'ConnectBusy' )
* Connection is busy.
* Wait until the connection is free before requery()ing in order
* to avoid the busy connection error.
DOEVENTS
WAIT WINDOW NOWAIT 'Requerying, please wait'
=INKEY( 0.1 )
ENDDO
=REQUERY( tcAlias )
Does anyone have any ideas about how best to deal with these errors?
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only