@@ -18,13 +18,16 @@ export async function selfHealJobs() {
1818 eq ( data . jobs . status , "running" ) ,
1919 lt (
2020 data . jobs . last_retrieved_at ,
21- sql `now() - interval '1 second' * timeout_interval_seconds`
21+ sql `now() - interval '1 second' * timeout_interval_seconds` ,
2222 ) ,
2323 // only timeout jobs that have a timeout set
2424 isNotNull ( data . jobs . timeout_interval_seconds ) ,
2525 // Don't time out jobs that have pending approval requests
26- or ( eq ( data . jobs . approval_requested , false ) , isNotNull ( data . jobs . approved ) )
27- )
26+ or (
27+ eq ( data . jobs . approval_requested , false ) ,
28+ isNotNull ( data . jobs . approved ) ,
29+ ) ,
30+ ) ,
2831 )
2932 . returning ( {
3033 id : data . jobs . id ,
@@ -53,7 +56,7 @@ export async function selfHealJobs() {
5356 . set ( {
5457 status : "stalled" ,
5558 // Don't subtrack this type of retry from the remaining attempts count
56- remaining_attempts : sql `remaining_attempts + 1`
59+ remaining_attempts : sql `remaining_attempts + 1` ,
5760 } )
5861 . where (
5962 and (
@@ -62,10 +65,10 @@ export async function selfHealJobs() {
6265 lt (
6366 data . jobs . updated_at ,
6467 // Find any jobs that have been interrupted for more than 5 minutes
65- sql `now() - interval '5 minutes'`
68+ sql `now() - interval '5 minutes'` ,
6669 ) ,
6770 eq ( data . jobs . approval_requested , false ) ,
68- )
71+ ) ,
6972 )
7073 . returning ( {
7174 id : data . jobs . id ,
@@ -76,9 +79,9 @@ export async function selfHealJobs() {
7679 if ( nonResumedInterruptions . length > 0 ) {
7780 logger . warn ( "Found interrupted jobs that have not been resumed" , {
7881 count : nonResumedInterruptions . length ,
79- jobs : nonResumedInterruptions . map ( row => row . id ) . join ( ", " )
82+ jobs : nonResumedInterruptions . map ( row => row . id ) . join ( ", " ) ,
8083 } ) ;
81- } ;
84+ }
8285
8386 const stalledJobs = await data . db
8487 . update ( data . jobs )
@@ -125,7 +128,9 @@ export async function selfHealJobs() {
125128
126129 return {
127130 stalledFailedByTimeout : stalledByTimeout . map ( row => row . id ) ,
128- stalledRecovered : stalledJobs . filter ( row => row . status === "pending" ) . map ( row => row . id ) ,
131+ stalledRecovered : stalledJobs
132+ . filter ( row => row . status === "pending" )
133+ . map ( row => row . id ) ,
129134 nonResumedInterruptions : nonResumedInterruptions . map ( row => row . id ) ,
130135 } ;
131136}
0 commit comments