@@ -77,8 +77,6 @@ pub fn add_crate(app: &App, krate: &Crate) -> CargoResult<()> {
77
77
/// file, deserlialise the crate from JSON, change the yank boolean to
78
78
/// `true` or `false`, write all the lines back out, and commit and
79
79
/// push the changes.
80
- // TODO: factor out the tasks this function does into smaller, separate
81
- // functions.
82
80
pub fn yank ( app : & App , krate : & str , version : & semver:: Version , yanked : bool ) -> CargoResult < ( ) > {
83
81
let repo = app. git_repo . lock ( ) . unwrap ( ) ;
84
82
let repo_path = repo. workdir ( ) . unwrap ( ) ;
@@ -118,6 +116,21 @@ pub fn yank(app: &App, krate: &str, version: &semver::Version, yanked: bool) ->
118
116
} )
119
117
}
120
118
119
+ /// Commits and pushes to the crates.io index.
120
+ ///
121
+ /// There are currently 2 instances of the crates.io backend running
122
+ /// on Heroku, and they race against each other e.g. if 2 pushes occur,
123
+ /// then one will succeed while the other will need to be rebased before
124
+ /// being pushed.
125
+ ///
126
+ /// A maximum of 20 attempts to commit and push to the index currently
127
+ /// accounts for the amount of traffic publishing crates, though this will
128
+ /// eventually need to be changed past a certain point.
129
+ ///
130
+ /// Notes:
131
+ /// Currently, this function is called from the HTTP thread and is blocking.
132
+ /// This could be changed to run from a different thread and use a callback
133
+ /// upon completion to the HTTP thread.
121
134
fn commit_and_push < F > ( repo : & git2:: Repository , mut f : F ) -> CargoResult < ( ) >
122
135
where
123
136
F : FnMut ( ) -> CargoResult < ( String , PathBuf ) > ,
0 commit comments