Merge pull request #479 from mozilla-services/release/0.2a-merge

chore: tag 0.2.5
This commit is contained in:
Philip Jenvey 2020-03-12 14:14:57 -07:00 committed by GitHub
commit 9fbc4e3300
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 11 deletions

View File

@ -1,3 +1,23 @@
<a name="0.2.5"></a>
## 0.2.5 (2020-03-11)
#### Bug Fixes
* relax MAX_TTL to 9 digits ([9b5bda50](https://github.com/mozilla-services/syncstorage-rs/commit/9b5bda5092ffa8852a812ba4f406358b0e6b780a), closes [#480](https://github.com/mozilla-services/syncstorage-rs/issues/480))
<a name="0.2.4"></a>
## 0.2.4 (2020-03-10)
#### Bug Fixes
* GETs with a limit and no sort never advance X-Weave-Next-Offset ([c95f2ff2](https://github.com/mozilla-services/syncstorage-rs/commit/c95f2ff21a5e3b428b2715018e7e782b22a2dfa8))
<a name="0.2.2"></a>
## 0.2.2 (2020-02-12)

2
Cargo.lock generated
View File

@ -2576,7 +2576,7 @@ dependencies = [
[[package]]
name = "syncstorage"
version = "0.2.2"
version = "0.2.5"
dependencies = [
"actix-cors 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"actix-http 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -1,6 +1,6 @@
[package]
name = "syncstorage"
version = "0.2.2"
version = "0.2.5"
license = "MPL-2.0"
authors = [
"Ben Bangert <ben@groovie.org>",

View File

@ -479,10 +479,11 @@ impl MysqlDb {
}
query = match sort {
Sorting::Index => query.order(bso::sortindex.desc()),
Sorting::Newest => query.order(bso::modified.desc()),
Sorting::Oldest => query.order(bso::modified.asc()),
_ => query,
Sorting::Index => query.order(bso::id.desc()).order(bso::sortindex.desc()),
Sorting::Newest | Sorting::None => {
query.order(bso::id.desc()).order(bso::modified.desc())
}
Sorting::Oldest => query.order(bso::id.asc()).order(bso::modified.asc()),
};
let limit = limit.map(i64::from).unwrap_or(-1);

View File

@ -1067,10 +1067,11 @@ impl SpannerDb {
sqltypes.insert("newer".to_string(), as_type(TypeCode::TIMESTAMP));
}
query = match sort {
Sorting::Index => format!("{} ORDER BY sortindex DESC", query),
Sorting::Newest => format!("{} ORDER BY modified DESC", query),
Sorting::Oldest => format!("{} ORDER BY modified ASC", query),
_ => query,
Sorting::Index => format!("{} ORDER BY sortindex DESC, bso_id DESC", query),
Sorting::Newest | Sorting::None => {
format!("{} ORDER BY modified DESC, bso_id DESC", query)
}
Sorting::Oldest => format!("{} ORDER BY modified ASC, bso_id ASC", query),
};
if let Some(limit) = limit {

View File

@ -41,7 +41,7 @@ use crate::web::{
const BATCH_MAX_IDS: usize = 100;
// BSO const restrictions
const BSO_MAX_TTL: u32 = 31_536_000;
const BSO_MAX_TTL: u32 = 999_999_999;
const BSO_MAX_SORTINDEX_VALUE: i32 = 999_999_999;
const BSO_MIN_SORTINDEX_VALUE: i32 = -999_999_999;
@ -2342,4 +2342,21 @@ mod tests {
assert_eq!(err["errors"][0]["name"], "uid");
*/
}
#[actix_rt::test]
async fn test_max_ttl() {
let bso_body = json!([
{"id": "123", "payload": "xxx", "sortindex": 23, "ttl": 94_608_000},
{"id": "456", "payload": "xxxasdf", "sortindex": 23, "ttl": 999_999_999},
{"id": "789", "payload": "xxxfoo", "sortindex": 23, "ttl": 1_000_000_000}
]);
let result = post_collection("", &bso_body)
.await
.expect("Could not get result in test_valid_collection_post_request");
assert_eq!(result.user_id.legacy_id, *USER_ID);
assert_eq!(&result.collection, "tabs");
assert_eq!(result.bsos.valid.len(), 2);
assert_eq!(result.bsos.invalid.len(), 1);
assert!(result.bsos.invalid.contains_key("789"));
}
}