11ty / 11ty/fetch

Add a default timeout when fetching

Open
#69 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
166
Forks
21
PR merge metrics
No merged PRs in 30d

Description

In building the 11ty Bundle website, I use eleventy-fetch to fetch the html of posts. If the site hosting the post is unreachable, the eleventy-build hangs at the point of the fetch. Feel like a bug.

I worked around it by making use of the fetchOption to add a 2 second custom timeout, like so:

fetchOptions: {
		signal: AbortSignal.timeout(2000)
	},

I'd have rather had a default timeout, but I'm not sure what the default timeout should be.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the fetchOptions handling and the request path responsible for fetching remote assets. Compare the existing AbortSignal.timeout workaround with the library's current behavior, then determine an appropriate default timeout and verify that unreachable hosts no longer leave the fetch hanging.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.