default void waitForResourceDeletion(ApiClient apiClient, List<String> pendingResources, String namespace,
                                         ActivityContext activityContext) throws HyscaleException {
        // TODO add events for every resource
        // TODO Changes to support name, field and label selectors
        if (pendingResources == null) {
            return;
        }
        long startTime = System.currentTimeMillis();
        while (!pendingResources.isEmpty()
                && (System.currentTimeMillis() - startTime < DeployerConstants.MAX_WAIT_TIME_IN_MILLISECONDS)) {
            Iterator<String> deletePendingResourceIterator = pendingResources.iterator();
            WorkflowLogger.continueActivity(activityContext);
            while (deletePendingResourceIterator.hasNext()) {
                String pendingResource = deletePendingResourceIterator.next();
                try {
                    get(apiClient, pendingResource, namespace);
                    getLogger().debug("Resource {} found to be existing, waiting for resource deletion", pendingResource);
                } catch (HyscaleException e) {
                    if (e.getHyscaleError() == DeployerErrorCodes.RESOURCE_NOT_FOUND) {
                        deletePendingResourceIterator.remove();
                    }
                }
            }
            ThreadPoolUtil.sleepSilently(DeployerConstants.DELETE_SLEEP_INTERVAL_IN_MILLIS);
        }
        // Fail case
        if (!pendingResources.isEmpty()) {
            if (activityContext != null) {
                WorkflowLogger.endActivity(activityContext, Status.FAILED);
            }
            getLogger().error("Resource deletion failed for: {}", pendingResources);
            throw new HyscaleException(DeployerErrorCodes.FAILED_TO_DELETE_RESOURCE, pendingResources.toString());
        }

    }
Wait until resource is no longer available
or timeout, in which case throws exception

@param apiClient
@param pendingResources
@param namespace
@param activityContext  for displaying continuation
@throws HyscaleException
deployer/deployer-services/src/main/java/io/hyscale/deployer/services/handler/ResourceLifeCycleHandler.java