Skip to content

Commit fb757b6

Browse files
authored
Merge branch 'dev' into issue-151-migrations
2 parents b1dbade + 3fe919f commit fb757b6

File tree

5 files changed

+19
-21
lines changed

5 files changed

+19
-21
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

primitives/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ authors = ["Lachezar Lechev <[email protected]>, Omidiora Samuel <[email protected]
55
edition = "2018"
66

77
[features]
8-
postgres = ["postgres-types", "bytes", "bb8-postgres"]
8+
postgres = ["postgres-types", "bytes", "tokio-postgres"]
99

1010
[dependencies]
1111
# Futures
@@ -39,7 +39,7 @@ rand = { version = "^0.6" }
3939
# postgres feature
4040
postgres-types = {version = "0.1.0-alpha.1", optional = true}
4141
bytes = { version = "0.4.12", optional = true}
42-
bb8-postgres = {git = "https://github.com/djc/bb8", branch = "async-await", features = ["with-chrono-0_4", "with-serde_json-1"], optional = true}
42+
tokio-postgres = {version = "0.5.0-alpha.1", optional = true, features = ["with-chrono-0_4", "with-serde_json-1"]}
4343

4444
# Other
4545
lazy_static = "1.4.0"

primitives/src/channel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,11 @@ impl Error for ChannelError {
198198
pub mod postgres {
199199
use super::ChannelId;
200200
use super::{Channel, ChannelSpec};
201-
use bb8_postgres::tokio_postgres::{types::Json, Row};
202201
use bytes::BytesMut;
203202
use hex::FromHex;
204203
use postgres_types::{FromSql, IsNull, ToSql, Type};
205204
use std::error::Error;
205+
use tokio_postgres::{types::Json, Row};
206206

207207
impl<'a> FromSql<'a> for ChannelId {
208208
fn from_sql(ty: &Type, raw: &'a [u8]) -> Result<Self, Box<dyn Error + Sync + Send>> {

sentry/src/lib.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ pub mod event_reducer;
3535
lazy_static! {
3636
static ref CHANNEL_GET_BY_ID: Regex =
3737
Regex::new(r"^/channel/0x([a-zA-Z0-9]{64})/?$").expect("The regex should be valid");
38-
static ref LAST_APPROVED_BY_CHANNEL_ID: Regex = Regex::new(r"^/channel/0x([a-zA-Z0-9]{64})/last-approved?$").expect("The regex should be valid");
39-
static ref CHANNEL_STATUS_BY_CHANNEL_ID: Regex = Regex::new(r"^/channel/0x([a-zA-Z0-9]{64})/status?$").expect("The regex should be valid");
38+
static ref LAST_APPROVED_BY_CHANNEL_ID: Regex = Regex::new(r"^/channel/0x([a-zA-Z0-9]{64})/last-approved/?$").expect("The regex should be valid");
39+
static ref CHANNEL_STATUS_BY_CHANNEL_ID: Regex = Regex::new(r"^/channel/0x([a-zA-Z0-9]{64})/status/?$").expect("The regex should be valid");
4040
// @TODO define other regex routes
4141
}
4242

@@ -63,8 +63,6 @@ pub struct Application<A: Adapter> {
6363
pub logger: Logger,
6464
pub redis: MultiplexedConnection,
6565
pub pool: DbPool,
66-
pub _clustered: bool,
67-
pub port: u16,
6866
pub config: Config,
6967
__secret: (),
7068
}
@@ -76,17 +74,13 @@ impl<A: Adapter + 'static> Application<A> {
7674
logger: Logger,
7775
redis: MultiplexedConnection,
7876
pool: DbPool,
79-
clustered: bool,
80-
port: u16,
8177
) -> Self {
8278
Self {
8379
adapter,
8480
config,
8581
logger,
8682
redis,
8783
pool,
88-
_clustered: clustered,
89-
port,
9084
__secret: (),
9185
}
9286
}

sentry/src/main.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,19 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
107107

108108
match adapter {
109109
AdapterTypes::EthereumAdapter(adapter) => {
110-
run(Application::new(
111-
*adapter, config, logger, redis, postgres, clustered, port,
112-
))
110+
run(
111+
Application::new(*adapter, config, logger, redis, postgres),
112+
clustered,
113+
port,
114+
)
113115
.await
114116
}
115117
AdapterTypes::DummyAdapter(adapter) => {
116-
run(Application::new(
117-
*adapter, config, logger, redis, postgres, clustered, port,
118-
))
118+
run(
119+
Application::new(*adapter, config, logger, redis, postgres),
120+
clustered,
121+
port,
122+
)
119123
.await
120124
}
121125
};
@@ -124,10 +128,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
124128
}
125129

126130
/// Starts the `hyper` `Server`.
127-
async fn run<A: Adapter + 'static>(app: Application<A>) {
128-
let addr = ([127, 0, 0, 1], app.port).into();
131+
async fn run<A: Adapter + 'static>(app: Application<A>, _clustered: bool, port: u16) {
132+
let addr = ([127, 0, 0, 1], port).into();
129133
let logger = app.logger.clone();
130-
info!(&logger, "Listening on port {}!", app.port);
134+
info!(&logger, "Listening on port {}!", port);
131135

132136
let make_service = make_service_fn(move |_| {
133137
let server = app.clone();

0 commit comments

Comments
 (0)