Script runs too long and sometimes times out

Author Message
spacedeveloper

  • Total Posts : 6
  • Scores: 0
  • Reward points : 0
  • Joined: 8/3/2010
  • Status: offline
Script runs too long and sometimes times out Wednesday, August 04, 2010 12:15 AM (permalink)
0
Hi everyone, I've been working on trying to track down a problem for days now and was wondering if someone may be able to help me on this one. I am trying to make a call to a sql server stored proc that takes a property id (we work in the hotel industry) and pings the property's server to see if it is down. when I run the stored proc directly from sql server the result comes back right away (including from a propertyid whose server is down).
 
However, when I run the script that called the stored proc (with a propertyid that is down) the page takes several minutes to refresh and many times just times out. I wonder why? We can't ask a customer to wait that long on a page...they'll just go somewhere else. Can anyone find the problem?
 
Thank you very much!!
 
P.S. The page works fine with properties whose server is up and running and returns a ping.  
  
    '*************************************************  ******** 
         Dim ExecuteCodeBlock 
         ExecuteCodeBlock = True 
         
         If ExecuteCodeBlock Then 
         
             Dim propSelect, firstPar, secondPar, PropertyID 
              
             ' Get propid from selected property dropdown 
             propSelect = request.form("HotID") 
             firstPar = InStr(propSelect, "(") 
             secondPar = InStr(propSelect, ")") 
             PropertyID = Mid(propSelect, firstPar + 1, secondPar - firstPar - 1) 
     
             If firstPar = "" Or secondPar = "" Or PropertyID = "" Then 
                 ' Selected dropdown property does not have any propid 
             Else  
     
                 Dim pingsql, down, rsPing, connPing, cmdPing  
                 down = True  
                 set connPing = server.createobject("adodb.connection")  
                 set cmdPing = server.createobject("adodb.command")  
                 connPing.open strConn  
                 set cmdPing.activeconnection = connPing  
                 cmdPing.commandtype = 4 'Stored Procedure Code  
                 cmdPing.commandtext = "sp_PingProperty"  
                 cmdPing.CommandTimeout = 10  
                 cmdPing.parameters(1) = PropertyID  
                 cmdPing.execute  
                 rsPing = cmdPing.parameters(0)  
        
                 If rsPing = 1 Then  
                     down = False  
                 Else  
                     down = True  
                 End If 
                              
                 rsPing.Close 
                 connPing.Close    
                 Set rsPing = Nothing 
                 Set connPing = Nothing 
                 
                 If down = True Then 
                     If system = "TEST" Then 
                         Response.Write ("<script type='text/javascript'>alert('We apologize! The property location you selected is experiencing technical difficulties. \n\rWe are working to resolve the issue. Please try your online payment again later.'); window.location = '//[TEST Hotel]/[page].asp';</script>") 
                     Else 
                         Response.Write ("<script type='text/javascript'>alert('We apologize! The property location you selected is experiencing technical difficulties. \n\rWe are working to resolve the issue. Please try your online payment again later.'); window.location = 'https://www./[LIVE Hotel].com/[page].asp';</script>") 
                     End If 
                 End If 
             End If 
             
         End If 
         '*******************************************  
     
     

<message edited by spacedeveloper on Wednesday, August 04, 2010 12:21 AM>
 
#1
    spacedeveloper

    • Total Posts : 6
    • Scores: 0
    • Reward points : 0
    • Joined: 8/3/2010
    • Status: offline
    Re:Script runs too long and sometimes times out Monday, August 30, 2010 7:14 AM (permalink)
    0
    Does anyone have any ideas as to why this script is running so long?? BTW, adjusting connPing.ConnectionTimeout has no affect on the amount of time the script takes to complete. The script almost always completes in about 110 sec. no matter what. The stored proc runs through its script just fine and returns a result within 10-15 sec AT MOST (based upon a log that is written to from the stored proc that can be tracked in real-time). So, anyone??? I appreciate any help.
     
    #2
      demonscout

      • Total Posts : 2
      • Scores: 0
      • Reward points : 0
      • Joined: 10/9/2010
      • Status: offline
      Re:Script runs too long and sometimes times out Saturday, October 09, 2010 9:43 PM (permalink)
      0
      Hi Space developer, it would help to diagnose the problem if we could also see the stored procedure causing the issue.

      I have a suspicion that the ping and stored procedure are running it a different manner when called from remote than when called from the stored procedure being run on the server. I don't think its permissions but something to think about.


       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • New Messages
        • No New Messages
        • Hot Topic w/ New Messages
        • Hot Topic w/o New Messages
        • Locked w/ New Messages
        • Locked w/o New Messages
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9