$database→retryDelay()

Get microseconds to wait before retrying a query that failed with a transient error

Applies the policy from retryOptions(): a delay of delayMs that grows linearly with each retry, up to maxDelayMs, for up to maxTries retries. When running from the command line and cliMaxTries is set, lost connection errors are allowed that many retries instead, so that long-running scripts can wait out a database restart or failover.

Available since version 3.0.275.

Usage

// basic usage
$int = $database->retryDelay(string $errorType, int $numTries);

// usage with all arguments
$int = $database->retryDelay(string $errorType, int $numTries, $maxTries = null);

Arguments

NameType(s)Description
$errorTypestring

Error type from WireDatabaseDialect::getRetryableErrorType()

$numTriesint

Number of retries already made

$maxTries (optional)int null

Max retries that overrides the configured policy, or null to use it Default:null

Return value

int false

Microseconds to wait before the next retry, or false if it should not be retried


$database methods and properties

API reference based on ProcessWire core version 3.0.275