You've already forked AstralRinth
forked from didirus/AstralRinth
Fix cache stampede issues + generalize cache (#884)
* caching changes * fix cache stampede issues * Use pub/sub for better DB fetches * remove pubsub * remove debugs * Fix caches not working * fix search indexing removal
This commit is contained in:
@@ -115,6 +115,8 @@ pub async fn pat_full_test() {
|
||||
"expires": Utc::now() + Duration::days(1), // no longer expired!
|
||||
}))
|
||||
.to_request();
|
||||
|
||||
println!("PAT ID FOR TEST: {}", id);
|
||||
let resp = test_env.call(req).await;
|
||||
assert_status!(&resp, StatusCode::NO_CONTENT);
|
||||
assert_eq!(mock_pat_test(access_token).await, 200); // Works again
|
||||
|
||||
@@ -69,7 +69,10 @@ async fn test_get_project() {
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
let cached_project: serde_json::Value = serde_json::from_str(&cached_project).unwrap();
|
||||
assert_eq!(cached_project["inner"]["slug"], json!(alpha_project_slug));
|
||||
assert_eq!(
|
||||
cached_project["val"]["inner"]["slug"],
|
||||
json!(alpha_project_slug)
|
||||
);
|
||||
|
||||
// Make the request again, this time it should be cached
|
||||
let resp = api.get_project(alpha_project_id, USER_USER_PAT).await;
|
||||
|
||||
@@ -55,7 +55,7 @@ async fn test_get_version() {
|
||||
.unwrap();
|
||||
let cached_project: serde_json::Value = serde_json::from_str(&cached_project).unwrap();
|
||||
assert_eq!(
|
||||
cached_project["inner"]["project_id"],
|
||||
cached_project["val"]["inner"]["project_id"],
|
||||
json!(parse_base62(alpha_project_id).unwrap())
|
||||
);
|
||||
|
||||
@@ -617,6 +617,7 @@ async fn version_ordering_for_specified_orderings_orders_lower_order_first() {
|
||||
USER_USER_PAT,
|
||||
)
|
||||
.await;
|
||||
|
||||
assert_common_version_ids(&versions, vec![new_version_id, alpha_version_id]);
|
||||
})
|
||||
.await;
|
||||
|
||||
Reference in New Issue
Block a user