Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
af70a8cf
Commit
af70a8cf
authored
Apr 14, 2026
by
Andrew Imm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 3x retries to font fetching in turbopack, similar to the webpack loader
parent
8319d6da
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
12 deletions
+42
-12
mod.rs
crates/next-core/src/next_font/google/mod.rs
+42
-12
No files found.
crates/next-core/src/next_font/google/mod.rs
View file @
af70a8cf
...
...
@@ -742,21 +742,51 @@ async fn fetch_from_google_fonts(
url
:
RcStr
,
virtual_path
:
FileSystemPath
,
)
->
Result
<
Option
<
Vc
<
HttpResponseBody
>>>
{
let
result
=
fetch_client
.fetch
(
url
,
Some
(
rcstr!
(
USER_AGENT_FOR_GOOGLE_FONTS
)))
.await
?
;
const
MAX_ATTEMPTS
:
usize
=
3
;
Ok
(
match
*
result
{
Ok
(
r
)
=>
Some
(
*
r
.await
?
.body
),
Err
(
err
)
=>
{
err
.to_issue
(
IssueSeverity
::
Warning
,
virtual_path
)
.to_resolved
()
.await
?
.emit
();
for
attempt
in
1
..=
MAX_ATTEMPTS
{
let
result
=
fetch_client
.fetch
(
url
.clone
(),
Some
(
rcstr!
(
USER_AGENT_FOR_GOOGLE_FONTS
)))
.await
?
;
None
match
&*
result
{
Ok
(
r
)
=>
{
if
attempt
>
1
{
tracing
::
info!
(
"Successfully fetched Google Font {} on attempt {}/{}"
,
url
,
attempt
,
MAX_ATTEMPTS
);
}
return
Ok
(
Some
(
*
r
.await
?
.body
));
}
Err
(
err
)
=>
{
if
attempt
<
MAX_ATTEMPTS
{
tracing
::
warn!
(
"Failed to fetch Google Font {} (attempt {}/{}), retrying..."
,
url
,
attempt
,
MAX_ATTEMPTS
);
}
else
{
tracing
::
warn!
(
"Failed to fetch Google Font {} after {} attempts"
,
url
,
MAX_ATTEMPTS
);
err
.to_issue
(
IssueSeverity
::
Warning
,
virtual_path
)
.to_resolved
()
.await
?
.emit
();
return
Ok
(
None
);
}
}
}
})
}
Ok
(
None
)
}
async
fn
get_mock_stylesheet
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment