Jacqueline.. thanks for these snippets

what about reset?

 if pError is "Previous request not completed"  behavior here I'm getting is 
that the attempt to run that repeat will fail because the network API is 
"locked up"

BR

On 8/4/16, 9:11 AM, "use-livecode on behalf of J. Landman Gay" 
<use-livecode-boun...@lists.runrev.com on behalf of jac...@hyperactivesw.com> 
wrote:

    We've had the same issue, the problem occurs usually on slower 
    connections. Chipp Walters gave me the workaround we're using now which 
    isn't perfect but seems to resolve many instances.
    
    function needToRetry pError -- Chipp Walters
       if pError is "timeout" or pError contains "socket timeout" or pError 
    contains "error socket closed" \
             or pError contains "Previous request not completed" then
         return true
       else
         return false
       end if
    end needToRetry
    
    In the script that gets or sends to the server (in our case, get) you 
    call the function and don't let the script proceed until it returns false:
    
      repeat 3 times -- Chipp's method for unreliable connections
             get url tURL
             put the result into tNetworkErr
             put it into tData
             if not needToRetry(tNetworkErr) then exit repeat
             wait 100 milliseconds -- don't use w/msgs, let it block
    end repeat
    
    Chipp originally repeated 5 times but 3 seems to work most of the time 
    and prevents an even longer delay. This will hang the script for a while 
    if the connection doesn't succeed right away. I set the socketTimeOut to 
    a lower number so that each attempt wouldn't wait the default 10 seconds.
    
    For most of our users, the repeat never has to iterate but for those 
    with problematic connections it seems to help a little.
    
    

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to