Skip to content

Commit 686a1ae

Browse files
Add notes about thread blocking
1 parent ee41651 commit 686a1ae

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/git.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,14 @@ pub fn yank(app: &App, krate: &str, version: &semver::Version, yanked: bool) ->
124124
/// being pushed.
125125
///
126126
/// 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.
127+
/// accounts for the amount of traffic publishing crates, though this may
128+
/// have to be changed in the future.
129129
///
130130
/// 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.
131+
/// Currently, this function is called on the HTTP thread and is blocking.
132+
/// Spawning a separate thread for this function means that the request
133+
/// can return without waiting for completion, and other methods of
134+
/// notifying upon completion or error can be used.
134135
fn commit_and_push<F>(repo: &git2::Repository, mut f: F) -> CargoResult<()>
135136
where
136137
F: FnMut() -> CargoResult<(String, PathBuf)>,

src/krate.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,10 @@ pub fn show(req: &mut Request) -> CargoResult<Response> {
11241124
/// Handles the `PUT /crates/new` route.
11251125
/// Used by `cargo publish` to publish a new crate or to publish a new version of an
11261126
/// existing crate.
1127+
///
1128+
/// Currently blocks the HTTP thread, perhaps some function calls can spawn new
1129+
/// threads and return completion or error through other methods a `cargo publish
1130+
/// --status` command, via crates.io's front end, or email.
11271131
pub fn new(req: &mut Request) -> CargoResult<Response> {
11281132
let app = req.app().clone();
11291133
let (new_crate, user) = parse_new_headers(req)?;

0 commit comments

Comments
 (0)