[Someone recently asked me in a thread on Reddit](https://www.reddit.com/r/Python/comments/1irlw3s/comment/mdjryfr/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button) about the difference between the `RefreshableCredentials` and `DeferredRefreshableCredentials` objects in `botocore`. That question got me thinking that I should finally add a `defer_refresh` option to `AutoRefreshableSession` so that users can choose between lazy and active temporary credential refreshes, which is something I planned on doing eventually but had not prioritized yet.
For context, the `DeferredRefreshableCredentials` object does not refresh temporary credentials until those credentials are explicitly needed; however, the `RefreshableCredentials` object refreshes temporary credentials the moment that they expire. The former is lazy; the latter is active. It is possible that the latter might be inefficient in some systems, hence my decision to finally include `defer_refresh` as a parameter.
Please note that, [according to one user](https://github.com/boto/botocore/issues/3366), `DeferredRefreshableCredentials` is leaking memory. I have not tested that claim myself; however, it may, according to their analysis, be something to be mindful of. You may, therefore, want to use `defer_refresh=False` in the meantime until that issue is resolved. I will monitor the issue and update the version of `boto3` in `pyproject.toml` accordingly.