detect resume files correctly in download_creations_pages_from_checkpoint
This commit is contained in:
27
src/main.rs
27
src/main.rs
@@ -1182,15 +1182,34 @@ async fn download_creations_pages_from_checkpoint(context:&CookieContext,owner:r
|
|||||||
|
|
||||||
let (mut asset_list,mut config)=if continue_from_cursor{
|
let (mut asset_list,mut config)=if continue_from_cursor{
|
||||||
// load state from files
|
// load state from files
|
||||||
let (versions,cursor)=tokio::try_join!(
|
let (versions,cursor)=tokio::join!(
|
||||||
tokio::fs::read(versions_path.as_path()),
|
tokio::fs::read(versions_path.as_path()),
|
||||||
tokio::fs::read_to_string(cursor_path.as_path()),
|
tokio::fs::read_to_string(cursor_path.as_path()),
|
||||||
)?;
|
);
|
||||||
|
// allow versions to not exist
|
||||||
|
let (versions,cursor)=match (versions,cursor){
|
||||||
|
// continue downloading
|
||||||
|
(Ok(versions),Ok(cursor))=>(serde_json::from_slice(&versions)?,Some(cursor)),
|
||||||
|
// already downloaded
|
||||||
|
(Ok(versions),Err(e)) if matches!(e.kind(),std::io::ErrorKind::NotFound)=>return Ok(serde_json::from_slice(&versions)?),
|
||||||
|
// not downloaded
|
||||||
|
(Err(e),result) if matches!(e.kind(),std::io::ErrorKind::NotFound)=>{
|
||||||
|
match result{
|
||||||
|
Ok(_)=>{},
|
||||||
|
Err(e) if matches!(e.kind(),std::io::ErrorKind::NotFound)=>{},
|
||||||
|
Err(e)=>Err(e)?,
|
||||||
|
}
|
||||||
|
(Vec::new(),None)
|
||||||
|
},
|
||||||
|
// other errors
|
||||||
|
(Ok(_),Err(e))=>Err(e)?,
|
||||||
|
(Err(e),_)=>Err(e)?,
|
||||||
|
};
|
||||||
(
|
(
|
||||||
serde_json::from_slice(&versions)?,
|
versions,
|
||||||
rbx_asset::cookie::CreationsPageRequest{
|
rbx_asset::cookie::CreationsPageRequest{
|
||||||
owner,
|
owner,
|
||||||
cursor:Some(cursor),
|
cursor,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
Reference in New Issue
Block a user