You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/next/src/server/app-render/app-render-scheduling.ts
+42-5Lines changed: 42 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -88,6 +88,12 @@ so for now, simply ensuring coordination is enough.
88
88
89
89
letcannotGuaranteeAtomicTimers=false
90
90
91
+
functionwarnAboutTimers(){
92
+
console.warn(
93
+
"Next.js cannot guarantee that Cache Components will run as expected due to the current runtime's implementation of `setTimeout()`.\nPlease report a github issue here: https://github.com/vercel/next.js/issues/new/"
94
+
)
95
+
}
96
+
91
97
/**
92
98
* Allows scheduling multiple timers (equivalent to `setTimeout(cb, delayMs)`)
93
99
* that are guaranteed to run in the same iteration of the event loop.
@@ -102,15 +108,48 @@ export function createAtomicTimerGroup(delayMs = 0) {
102
108
)
103
109
}else{
104
110
letfirstTimerIdleStart: number|null=null
111
+
letdidFirstTimerRun=false
112
+
113
+
// As a sanity check, we schedule an immediate from the first timeout
// NodeJS timers to have a `_idleStart` property, but it doesn't exist e.g. in Bun.
115
154
// If it's not present, we'll warn and try to continue.
116
155
try{
@@ -125,10 +164,8 @@ export function createAtomicTimerGroup(delayMs = 0) {
125
164
timer._idleStart=firstTimerIdleStart
126
165
}
127
166
}else{
128
-
console.warn(
129
-
"Next.js cannot guarantee that Cache Components will run as expected due to the current runtime's implementation of `setTimeout()`.\nPlease report a github issue here: https://github.com/vercel/next.js/issues/new/"
130
-
)
131
167
cannotGuaranteeAtomicTimers=true
168
+
warnAboutTimers()
132
169
}
133
170
}catch(err){
134
171
// This should never fail in current Node, but it might start failing in the future.
0 commit comments