View Complete Thread | FoxWeb Forum Home
Date:    Msg ID:   
From:    Thread:   
The SetScriptTimeout and AddScriptTimeout methods of the Server object do not have 999 as the upper limit.  If you wish you can use 1200, which will give you 20 minutes.

Use SetScriptTimeout in cases where you either know in advance how long a script will take, or the delay is caused by a single statement (such as a long query), which will prevent you from using AddScriptTimeout.  Use AddScriptTimeout in cases where the delay is caused by multiple commands -- especially with long loops.

Here's some sample code, which illustrates the use of SetScriptTimeout.  If you wanted you could also use Server.AddScriptTimeout(10) within the FOR/NEXT loop.  This would be especially useful if you didn't know how many iterations you would eventually end up with.

Response.Buffer = .F.
* Silly work-around to IE buffering problem
Response.Write(REPLICATE(" ", 255))
StartTime = DATETIME()
Response.Write(TTOC(StartTime) + "<br>")
FOR i = 1 TO 180
    WAIT '' TIMEOUT 10
    Response.Write(STR(DATETIME() - StartTime) + " seconds<br>")

FoxWeb Support Team

Sent by D.B. Stepp on 02/14/2002 02:57:40 PM:
I've been working on a script that takes about 10 minutes to run.  This is normal for this script and I only run it once a day.  However, I began to add more code that has caused the script to run for an estimated 20 minutes.  I've been having a few small problems.

Originally I tried to add Server.SetScriptTimeout(999) and/or    Server.AddScriptTimeout(999) to the top of the script.  In the control center I had Script Timeout set to 30 seconds.  I also has Restart Channels checked.  No matter what I tried, the script timed out and the channel restarted after 30 seconds.

My next try led me to turn off Restart Channels and change Script Timeout to 999.  This allow my script to run uninterrupted.  However, any locked up channels do not restart and any other script I run will take a little over 16 minutes to timeout.

Now, with my script looking like it may take more than 16 minutes, I think I need a new solution.  It seems 999 seconds is that max that can be set in the Control Center, I can't seem to get the Server. objects to work on a per script basis and I'd really like my channels to restart themselves.  Any ideas?

I plan on purchasing another copy of FoxWeb for use on a different server to run this script.  This was the plan before I encountered these problems, but I want/need to use both servers for other programs as well.

Thanks in advance.