I have an event subscription that fires upon CHANGE_LEASE completion, that currently just displays some information about the parent deployment. It always shows the old lease end time, not the new one that I set it to. I've tried getting the entity again, invalidating the entity, and even sleeping for 5 seconds (gross), but it never displays the new lease end time. Is there a way to refresh Orchestrator's information about this catalog resource?
This doesn't work:
if (actualDeploymentId != null && actualDeploymentId != undefined && actualDeploymentId != "") {
System.debug("actualDeploymentId: " + actualDeploymentId);
parentResource = vCACCAFEEntitiesFinder.getCatalogResource(host, actualDeploymentId);
vCACCAFEEntitiesFinder.invalidateEntity(parentResource);
System.sleep(5000);
parentResource = vCACCAFEEntitiesFinder.getCatalogResource(host, actualDeploymentId);
System.debug("Lease end: " + parentResource.lease.getEnd());
}
Did you try looping for a bit to see if it eventually refreshes? In our 6.x environment I have found some things seem to take 30-60 seconds to refresh but eventually do.
Yes, it eventually updates. The problem with looping is that I don't have the state before the request was submitted to compare to. I can't be certain that the very first poll isn't the updated value, so I can't be certain that subsequent unchanged values are out of date. For now, I've found that blindly sleeping for 20 seconds always seems to work. Maybe I should bump that up to 60 seconds, just to be safe. I'm only sending updated appointments for their VM leases; they can probably wait a minute to get them.
I am still on version 6 but in version 7 can you create another subscription to the lease change submission to capture the state?