Detect if relay select completion

Is there a good way to detect when “relay select” is complete? I have additional logic I need to run after the relay is selected and the best way I have been able to do this is to sort of sleep:

// Force client to send update to relay
relay select

// ***************************************************************************
// set utility cache property for desktop machines
// ***************************************************************************
if {exists ("win7"; "win8"; "win10") whose (operating system as string as lowercase contains it)}
	
	//wait 60 seconds to make sure the relay is updated
	parameter "startTime2"="{now}"
	pause while { (now-time(parameter "startTime2") < 60*second) }

	parameter "_server" = "{preceding text of first ":" of (following text of first "//" of (value of setting "__RelayServer1" of client))}"

…and so on. I would rather not use the pause while part unless I could detect if the agent was in a state of selecting it’s realy.

Could you check for effective date of setting "__RelayServer1" of client ?

Probably something like
pause while {(not exists setting "__RelayServer1" whose (effective date of it > active start time of action) of client) AND (now - active start time of action < 10 * minute)}

1 Like

That did the trick! I’ve only recently found that “effective date” option of a property. Forgot to remember about that! :wink:

I take that back. It’s blowing by it. I will dig in a bit more but this may get me close.