File tree Expand file tree Collapse file tree
frontend/src/components/Video Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -104,8 +104,8 @@ function SubtitleForm ({video, token}){
104104 const response = await client . resyncSubtitle ( videoid , subid ) ;
105105 const task_id = response . data . taskid ;
106106 setsubstate ( "loading" ) ;
107- while ( 1 ) {
108- await wait ( 1000 ) ;
107+ var IntervalHandler = setInterval ( async function ( ) {
108+
109109 const response2 = await client . getTaskStatusByID ( task_id ) ;
110110 if ( response2 . state === "SUCCESS" ) {
111111 setsubstate ( "finished" ) ;
@@ -122,12 +122,13 @@ function SubtitleForm ({video, token}){
122122 video . textTracks [ 0 ] . mode = "showing" ; // thanks Firefox
123123 } ) ;
124124 videoElement . appendChild ( track ) ;
125- break ;
125+ clearInterval ( IntervalHandler ) ;
126126 } else if ( response2 . state === "FAILURE" ) {
127127 setsubstate ( "failure" ) ;
128- break ;
129- }
130- }
128+ clearInterval ( IntervalHandler ) ;
129+ }
130+
131+ } , 3000 ) ;
131132
132133 } ;
133134
You can’t perform that action at this time.
0 commit comments