File tree Expand file tree Collapse file tree 4 files changed +23
-17
lines changed Expand file tree Collapse file tree 4 files changed +23
-17
lines changed Original file line number Diff line number Diff line change @@ -25,9 +25,7 @@ export default function Home() {
25
25
const intervalTimer = startDuration ( ) ;
26
26
try {
27
27
setLoading ( true ) ;
28
- const res = await fetch ( `/try?url=${ url } ` , {
29
- next : { revalidate : 10 } ,
30
- } ) ;
28
+ const res = await fetch ( `/try?url=${ url } ` ) ;
31
29
const data = await res . blob ( ) ;
32
30
setImgUrl ( URL . createObjectURL ( data ) ) ;
33
31
} catch ( error ) {
@@ -43,8 +41,15 @@ export default function Home() {
43
41
44
42
function startDuration ( ) {
45
43
return setInterval ( ( ) => {
46
- setDuration ( ( prev ) => Number ( ( prev + 0.2 ) . toFixed ( 1 ) ) ) ;
47
- } , 200 ) ;
44
+ setDuration ( ( prev ) => {
45
+ const newDuration = Number ( ( prev + 1 ) . toFixed ( 1 ) ) ;
46
+ if ( newDuration >= 300 ) {
47
+ clearInterval ( intervalTimer ) ;
48
+ return 300 ;
49
+ }
50
+ return newDuration ;
51
+ } ) ;
52
+ } , 1000 ) ;
48
53
}
49
54
50
55
return (
@@ -59,14 +64,8 @@ export default function Home() {
59
64
Try screenshot
60
65
</ h3 >
61
66
< p className = "text-md mt-3" >
62
- Thursday, May 9th 2024 Vercel Functions for Hobby can now run up to
63
- 60 seconds{ " " }
64
- < a
65
- href = "https://vercel.com/changelog/vercel-functions-for-hobby-can-now-run-up-to-60-seconds"
66
- className = "text-blue-500 underline"
67
- >
68
- detail
69
- </ a >
67
+ can now run up to
68
+ 300 seconds{ " " }
70
69
</ p >
71
70
</ div >
72
71
< form onSubmit = { handleSubmit } >
Original file line number Diff line number Diff line change 9
9
remoteExecutablePath ,
10
10
} from "@/utils/utils.js" ;
11
11
12
- export const maxDuration = 60 ;
12
+ export const maxDuration = 300 ; //sec
13
13
export const dynamic = "force-dynamic" ;
14
14
15
15
const chromium = require ( "@sparticuz/chromium-min" ) ;
@@ -81,7 +81,7 @@ export async function GET(request) {
81
81
try {
82
82
const response = await page . goto ( urlStr , {
83
83
waitUntil : "networkidle2" ,
84
- timeout : 60000 ,
84
+ timeout : 300_000 ,
85
85
} ) ;
86
86
87
87
if ( ! response || ! response . ok ( ) ) {
@@ -104,7 +104,7 @@ export async function GET(request) {
104
104
) ;
105
105
} ) ;
106
106
107
- await new Promise ( ( res ) => setTimeout ( res , 6000 ) ) ;
107
+ // await new Promise((res) => setTimeout(res, 6000));
108
108
await cfCheck ( page ) ;
109
109
110
110
for ( let shotTry = 1 ; shotTry <= 2 ; shotTry ++ ) {
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ async function cfCheck(page) {
32
32
const input = document . getElementById ( `cf-chl-widget-${ widgetId } _response` ) ;
33
33
return input && input . value && input . value !== "" ;
34
34
} ,
35
- { timeout : 15000 } ,
35
+ { timeout : 300_000 } ,
36
36
id
37
37
) ;
38
38
Original file line number Diff line number Diff line change
1
+ {
2
+ "functions" : {
3
+ "app/try/route.js" : {
4
+ "maxDuration" : 300
5
+ }
6
+ }
7
+ }
You can’t perform that action at this time.
0 commit comments