@@ -242,7 +242,9 @@ async fn get_issue_page(
242242 . per_page ( 100 )
243243 . direction ( params:: Direction :: Ascending )
244244 . sort ( sort)
245- . since ( since. unwrap_or_default ( ) )
245+ // for some reason, the GitHub API doesn't return anything
246+ // if you give it 1970-01-01 00:00:00 UTC, so give it 1970-01-02.
247+ . since ( since. unwrap_or ( Utc . with_ymd_and_hms ( 1970 , 1 , 2 , 0 , 0 , 0 ) . unwrap ( ) ) )
246248 . state ( params:: State :: All )
247249 . page ( page)
248250 . send ( )
@@ -577,7 +579,9 @@ async fn main() -> ExitCode {
577579 }
578580 } ) ;
579581
582+ let mut written_anything = false ;
580583 while let Some ( data) = receiver. recv ( ) . await {
584+ written_anything = true ;
581585 if let Err ( e) = write ( data. clone ( ) , args. destination . clone ( ) ) {
582586 error ! (
583587 "Could not write {} to {}: {}" ,
@@ -591,14 +595,17 @@ async fn main() -> ExitCode {
591595 }
592596
593597 if task. await . is_ok ( ) {
594- if let Err ( e) = write_backup_state ( start_time, args. destination . clone ( ) ) {
595- error ! (
596- "Failed to write {} to {}: {}" ,
597- STATE_FILE ,
598- args. destination. clone( ) . display( ) ,
599- e
600- ) ;
601- return ExitCode :: from ( EXIT_WRITING ) ;
598+ // only write state file if we actually wrote anything
599+ if written_anything {
600+ if let Err ( e) = write_backup_state ( start_time, args. destination . clone ( ) ) {
601+ error ! (
602+ "Failed to write {} to {}: {}" ,
603+ STATE_FILE ,
604+ args. destination. clone( ) . display( ) ,
605+ e
606+ ) ;
607+ return ExitCode :: from ( EXIT_WRITING ) ;
608+ }
602609 }
603610 } else {
604611 return ExitCode :: from ( EXIT_API_ERROR ) ;
0 commit comments