def prefetch()

in alibabacloud_credentials/provider/refreshable.py [0:0]


    def prefetch(self, action: Callable):
        if not CONCURRENT_REFRESH_LEASES.acquire(False):
            log.warning('Skipping a background refresh task because there are too many other tasks running.')
            return

        try:
            EXECUTOR.submit(action)
        except KeyboardInterrupt:
            _shutdown_handler()
        except Exception as t:
            log.warning(f'Exception occurred when submitting background task.', exc_info=True)
        finally:
            CONCURRENT_REFRESH_LEASES.release()