File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -1286,11 +1286,23 @@ pub async fn ensure_channel_initialized(op: &Operator) -> anyhow::Result<()> {
12861286 } ;
12871287
12881288 let repodata_bytes = serde_json:: to_vec ( & empty_repodata) ?;
1289- op. write_with ( & noarch_repodata_path, repodata_bytes)
1289+ match op
1290+ . write_with ( & noarch_repodata_path, repodata_bytes)
1291+ . if_not_exists ( true )
12901292 . cache_control ( CACHE_CONTROL_REPODATA )
1291- . await ?;
1292-
1293- Ok ( ( ) )
1293+ . await
1294+ {
1295+ Ok ( _) => {
1296+ tracing:: info!( "Successfully initialized channel" ) ;
1297+ Ok ( ( ) )
1298+ }
1299+ Err ( e) if e. kind ( ) == opendal:: ErrorKind :: ConditionNotMatch => {
1300+ // Another process created the file - that's fine, channel is initialized
1301+ tracing:: debug!( "Channel already initialized by another process" ) ;
1302+ Ok ( ( ) )
1303+ }
1304+ Err ( e) => Err ( e. into ( ) ) ,
1305+ }
12941306}
12951307
12961308/// Ensures that a filesystem channel has a valid `noarch/repodata.json` file.
You can’t perform that action at this time.
0 commit comments