ContributorMural::HTTPAvatarSource
Inherits ContributorMural::AvatarSource < Reference < Object
Fetches avatars over HTTP, or straight from the workspace when
avatar_url is a plain relative path (org logos, folks without a GitHub
account). HTTP::Client does not follow redirects and
github.com/<login>.png answers with a 301, so redirects are handled here.
Constants
Avatars are small; anything larger is a misconfigured URL, and the bytes end up base64-encoded inside a committed file.
A server may name any delay it likes; we still have a job to finish.
Statuses worth another attempt. 429 and 408 are the reason this is a list
rather than >= 500: a throttled or timed-out request used to count as a
permanent failure, and the mural quietly lost that person's face — the one
outcome nobody notices until the picture is already committed.
Sent on every request: an unidentified client is the first thing a CDN throttles, and being throttled here costs us faces.
Constructors
Both flags exist for specs, which fetch from and redirect between
127.0.0.1 ports; production keeps redirects on public https only and
refuses to fetch from the runner's own network at all.
allow_local_redirects implies allow_local_targets, since a spec that
follows a local redirect had to reach the local server first.
Class methods
Instance methods
Hands back the connections this source opened.
Keep-alive means a source holds a socket open to every host it spoke to until something says otherwise, and a source that built its own pool had no way to say it. The connection then sat there until the garbage collector happened to reach it — invisible to the action, which owns one pool for the whole run and closes it, and unbounded for anything that builds a source per repository in a loop.
A no-op when the pool was handed in: closing someone else's pool hangs up on whoever else is still using it.
Returns image bytes and content type for the avatar at size px.
Stable identity of the request, used as the cache/dedupe key.