Failure to fetch assertions stops installation immediately

I was just trying to install a snap and it bombed out mid way - this is my session:

laney@nightingale> snap install code --classic
error: cannot perform the following tasks:
- Fetch and check assertions for snap "code" (23) (Get https://api.snapcraft.io/api/v1/snaps/assertions/snap-revision/_BSGjykfN60hxNeIl3PEjlr_CWe9tIui1CTxaqXoLuqwylMOumRrdPUA_R9lNiuy?max-format=0: dial tcp: lookup api.snapcraft.io: no such host)
laney@nightingale> snap install code --classic
code 26076a4d from Visual Studio Code (vscode✓) installed
laney@nightingale> snap version
snap    2.42.5
snapd   2.42.5
series  16
ubuntu  20.04
kernel  5.3.0-23-generic

There’s a couple of things here that could maybe be improved:

  • That DNS failure was transient. Would it be possible to retry fetches like this?
  • When I issued the second snap install, the same snap was fetched again. I’m on tethered (metered) data, so this could be expensive as well as slow. It’s 144MB! How about some limited caching?