Skip to content

Commit a7cbb3d

Browse files
committed
Merge remote-tracking branch 'upstream/master' into update-itertools-log
2 parents 7414dc5 + c0327a3 commit a7cbb3d

35 files changed

+503
-244
lines changed

.diesel_version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.0
1+
1.4.0

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ install:
3030
- cargo install --force diesel_cli --vers `cat .diesel_version` --no-default-features --features postgres && export PATH=$HOME/.cargo/bin:$PATH
3131

3232
before_script:
33-
- diesel database setup
33+
- diesel database setup --locked-schema
3434

3535
addons:
3636
chrome: stable

Cargo.lock

Lines changed: 253 additions & 110 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ htmlescape = "0.3.1"
4747
license-exprs = "^1.4"
4848
dotenv = "0.11.0"
4949
toml = "0.4"
50-
diesel = { version = "1.3.0", features = ["postgres", "serde_json", "chrono", "r2d2"] }
50+
diesel = { version = "1.4.0", features = ["postgres", "serde_json", "chrono", "r2d2"] }
5151
diesel_full_text_search = "1.0.0"
5252
diesel_ltree = "0.1.3"
5353
serde_json = "1.0.0"
@@ -62,14 +62,15 @@ scheduled-thread-pool = "0.2.0"
6262
derive_deref = "1.0.0"
6363
reqwest = "0.9.1"
6464
tempdir = "0.3.7"
65+
parking_lot = "0.7.1"
6566

6667
lettre = {git = "https://github.com/lettre/lettre", version = "0.9"}
6768
lettre_email = {git = "https://github.com/lettre/lettre", version = "0.9"}
6869

6970
conduit = "0.8"
7071
conduit-conditional-get = "0.8"
71-
conduit-cookie = "0.8"
72-
cookie = "0.9"
72+
conduit-cookie = "0.8.5"
73+
cookie = "0.11"
7374
conduit-middleware = "0.8"
7475
conduit-router = "0.8"
7576
conduit-static = "0.8"
@@ -89,7 +90,3 @@ tokio-service = "0.1"
8990
dotenv = "0.11"
9091
diesel = { version = "1.3.0", features = ["postgres"] }
9192
diesel_migrations = { version = "1.3.0", features = ["postgres"] }
92-
93-
# Remove once cookie depends on ring >= 0.13.0
94-
[patch.crates-io]
95-
ring = { git = "https://github.com/SergioBenitez/ring", branch = "v0.11" }

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
web: bin/diesel migration run && bin/start-nginx ./target/release/server
1+
web: bin/diesel migration run --locked-schema && bin/start-nginx ./target/release/server
22
worker: ./target/release/update-downloads daemon 300

src/app.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ impl App {
7373
let db_connection_timeout = match (env::var("DB_TIMEOUT"), config.env) {
7474
(Ok(num), _) => num.parse().expect("couldn't parse DB_TIMEOUT"),
7575
(_, Env::Production) => 10,
76+
(_, Env::Test) => 1,
7677
_ => 30,
7778
};
7879

@@ -88,7 +89,7 @@ impl App {
8889
let repo = git2::Repository::open(&config.git_repo_checkout).unwrap();
8990

9091
App {
91-
diesel_database: db::diesel_pool(&config.db_url, diesel_db_config),
92+
diesel_database: db::diesel_pool(&config.db_url, config.env, diesel_db_config),
9293
github,
9394
session_key: config.session_key.clone(),
9495
git_repo: Mutex::new(repo),

src/bin/update-downloads.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![deny(warnings)]
2-
#![allow(unknown_lints, proc_macro_derive_resolution_fallback)] // This can be removed after diesel-1.4
32

43
#[macro_use]
54
extern crate diesel;
@@ -138,7 +137,7 @@ mod test {
138137
name: "foo",
139138
..Default::default()
140139
}
141-
.create_or_update(&conn, None, user_id)
140+
.create_or_update(conn, None, user_id)
142141
.unwrap();
143142
let version = NewVersion::new(
144143
krate.id,
@@ -149,7 +148,7 @@ mod test {
149148
0,
150149
)
151150
.unwrap();
152-
let version = version.save(&conn, &[]).unwrap();
151+
let version = version.save(conn, &[]).unwrap();
153152
(krate, version)
154153
}
155154

src/controllers/crate_owner_invitation.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ struct OwnerInvitation {
3232

3333
/// Handles the `PUT /me/crate_owner_invitations/:crate_id` route.
3434
pub fn handle_invite(req: &mut dyn Request) -> CargoResult<Response> {
35-
let conn = &*req.db_conn()?;
36-
3735
let mut body = String::new();
3836
req.body().read_to_string(&mut body)?;
3937

38+
let conn = &*req.db_conn()?;
39+
4040
let crate_invite: OwnerInvitation =
4141
serde_json::from_str(&body).map_err(|_| human("invalid json request"))?;
4242

@@ -50,7 +50,7 @@ pub fn handle_invite(req: &mut dyn Request) -> CargoResult<Response> {
5050
}
5151

5252
fn accept_invite(
53-
req: &mut dyn Request,
53+
req: &dyn Request,
5454
conn: &PgConnection,
5555
crate_invite: InvitationResponse,
5656
) -> CargoResult<Response> {
@@ -88,7 +88,7 @@ fn accept_invite(
8888
}
8989

9090
fn decline_invite(
91-
req: &mut dyn Request,
91+
req: &dyn Request,
9292
conn: &PgConnection,
9393
crate_invite: InvitationResponse,
9494
) -> CargoResult<Response> {

src/controllers/krate/publish.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub fn publish(req: &mut dyn Request) -> CargoResult<Response> {
6363
let categories = new_crate.categories.as_ref().map(|s| &s[..]).unwrap_or(&[]);
6464
let categories: Vec<_> = categories.iter().map(|k| &***k).collect();
6565

66-
let conn = req.db_conn()?;
66+
let conn = app.diesel_database.get()?;
6767

6868
let mut other_warnings = vec![];
6969
if !user.has_verified_email(&conn)? {

src/controllers/krate/search.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ pub fn search(req: &mut dyn Request) -> CargoResult<Response> {
171171

172172
let badges = CrateBadge::belonging_to(&crates)
173173
.select((badges::crate_id, badges::all_columns))
174-
.load::<CrateBadge>(&conn)?
174+
.load::<CrateBadge>(&*conn)?
175175
.grouped_by(&crates)
176176
.into_iter()
177177
.map(|badges| badges.into_iter().map(|cb| cb.badge).collect());

0 commit comments

Comments
 (0)