pause

The pause statement is used to suspend execution of a USE script for a specified time.

Syntax

pausedelaytime

Details

The delaytime parameter is the number of milliseconds to wait before continuing. A value of 0 is allowed, in which case no delay will occur.

The pause statement may be useful in cases where an external data source imposes some form of rate limiting on the number of queries that can be serviced in a given time-frame, or to slow down execution at critical points when debugging a long or complex script.

Example

This example makes use of script parameters which are provided when USE is executed. For more information on script parameters please refer to the Extract introduction.

var first = ${ARG_1}
var last = ${ARG_2}
var last += 1
var x = ${first}

# Retrieve a number of files from http://server.local/?.dat where ? is a number
# Wait for 1 second between each file
loop slurp {
    var url = http://server.local/datafiles/${x}.dat
    set http_savefile data/${x}.png
    print Getting datafile ${x}
    http GET ${url}
    if (${HTTP_STATUS_CODE} == 200) {
        print 200 OK
    }
    if (${HTTP_STATUS_CODE} == 404) {
        print Data file ${x} missing on server
    }
    var x += 1
    if (${x} == ${last}) {
        exit_loop
    }
        pause 1000   # Wait for 1 second
}
print ${x} files were downloaded
terminate

Last updated