Skip to content

Commit

Permalink
Bump scylla to v0.12.0 (StractOrg#144)
Browse files Browse the repository at this point in the history
Previously we were on a fixed rev due to unreleased pull-requests, but since these are now released we can pin to a crates.io version!

v0.11 introduced a breaking change in how `scylla::frame::value`'s are represented, most importantly around timestamps. Previously the timestamp was constructed from a duration, but now it takes an actual timestamp. In the old version, `Duration::seconds(0)` was used as the default, but now we have to provide a timestamp. I'm a little but uncertain what is equivalent, but I believe `chrono::Utc::now` is what we intent to store.
  • Loading branch information
oeb25 authored Feb 15, 2024
1 parent 2987079 commit b029d6b
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 42 deletions.
85 changes: 49 additions & 36 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ rusqlite = {version = "0.29.0", features = [
rust-s3 = {version = "0.33.0", features = ["blocking", "tokio"]}
rust-stemmers = "1.2.0"
safetensors = "0.3.1"
scylla = {git = "https://github.com/scylladb/scylla-rust-driver", rev = "82c1c99f0ff86509f9dd1e649ecdaddc5a3660cf"}
scylla = {version = "0.12.0", features = ["chrono"]}
serde = {version = "1.0.137", features = ["rc", "derive"]}
serde_json = "1.0.81"
serde_urlencoded = "0.7.1"
Expand Down
7 changes: 2 additions & 5 deletions crates/core/src/improvement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,7 @@ impl ScyllaConn {

async fn store_query(&self, query: StoredQuery) {
let urls = serde_json::to_string(&query.result_urls).unwrap();
let timestamp = query
.timestamp
.map(|timestamp| chrono::Duration::seconds(timestamp.timestamp()))
.unwrap_or_else(|| chrono::Duration::seconds(0));
let timestamp = query.timestamp.unwrap_or_else(chrono::Utc::now);
let qid = query.qid;

let res = self
Expand All @@ -163,7 +160,7 @@ impl ScyllaConn {
qid,
query.query,
urls,
scylla::frame::value::Timestamp(timestamp),
scylla::frame::value::CqlTimestamp::from(timestamp),
),
)
.await;
Expand Down

0 comments on commit b029d6b

Please sign in to comment.