ClientApi::SetRPCRetries( int )

Sets the number of times the client retries a command that the server refuses because of rate limiting.

Virtual?

No

 

Class

ClientApi

 

Arguments

int maxRetries

the maximum number of times to retry a command that is refused by rate limiting

Returns

void

 

Notes

By default, a client does not retry a command that the server refuses because of rate limiting. The command fails with the MsgRpc::RateLimit error. To make the client retry the command, call SetRPCRetries() before Run(). This method is the equivalent of the -r N global option on the command line.

When the server refuses a command, the client disconnects, waits for the delay that the server specifies, reconnects, and resends the same command. All of these steps happen within a single call to Run(). The client limits the delay to a range of 0 to 300 seconds. The client stops retrying after maxRetries attempts.

For more information about rate limiting, see Limit the rate of user commands in the P4 Server Administration Documentation. For the error that the client reports, see Rate limit errors.

Example

The following example retries a command up to five times if the server refuses it because of rate limiting.

ClientApi client;
Error e;

client.SetRPCRetries( 5 );
client.Init( &e );
client.Run( "sync", &ui );
client.Final( &e );