Compare commits
No commits in common. "220a1f91b0b5977313f33d243a9b85e743536318" and "997f9b4617484952ab946afbc3f7f15355557482" have entirely different histories.
220a1f91b0
...
997f9b4617
@ -28,11 +28,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Install Rust toolchain
|
- name: Install Rust toolchain
|
||||||
run: |
|
run: |
|
||||||
for i in 1 2 3; do
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable && break
|
|
||||||
echo "rustup install attempt $i failed, retrying..."
|
|
||||||
sleep 15
|
|
||||||
done
|
|
||||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Install Node.js
|
- name: Install Node.js
|
||||||
@ -82,11 +78,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Install Rust toolchain
|
- name: Install Rust toolchain
|
||||||
run: |
|
run: |
|
||||||
for i in 1 2 3; do
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable && break
|
|
||||||
echo "rustup install attempt $i failed, retrying..."
|
|
||||||
sleep 15
|
|
||||||
done
|
|
||||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
- name: Install Node.js
|
- name: Install Node.js
|
||||||
|
|||||||
@ -45,13 +45,6 @@ DB_POOL_SIZE=20 # database connection pool size
|
|||||||
SSR_CACHE_SECS=3600 # incremental SSR cache TTL
|
SSR_CACHE_SECS=3600 # incremental SSR cache TTL
|
||||||
```
|
```
|
||||||
|
|
||||||
Session / security tuning:
|
|
||||||
|
|
||||||
```
|
|
||||||
COOKIE_SECURE=false # set true/1/yes to add Secure flag to session cookie
|
|
||||||
TRUSTED_PROXY_COUNT=0 # number of reverse proxies in front of the app; used to extract real client IP from X-Forwarded-For
|
|
||||||
```
|
|
||||||
|
|
||||||
Run migrations before first dev server start:
|
Run migrations before first dev server start:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@ -44,7 +44,6 @@ js-sys = "0.3"
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tokio = { version = "1.52", features = ["rt-multi-thread", "macros", "fs", "time", "sync"] }
|
tokio = { version = "1.52", features = ["rt-multi-thread", "macros", "fs", "time", "sync"] }
|
||||||
serial_test = "3"
|
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
debug = false
|
debug = false
|
||||||
|
|||||||
14
src/cache.rs
14
src/cache.rs
@ -330,10 +330,8 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::models::comment::PublicComment;
|
use crate::models::comment::PublicComment;
|
||||||
use crate::models::post::PostStatus;
|
use crate::models::post::PostStatus;
|
||||||
use serial_test::serial;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[serial]
|
|
||||||
fn cache_key_equality() {
|
fn cache_key_equality() {
|
||||||
let k1 = CacheKey::PublishedPosts {
|
let k1 = CacheKey::PublishedPosts {
|
||||||
page: 1,
|
page: 1,
|
||||||
@ -352,7 +350,6 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
|
||||||
async fn post_list_cache_roundtrip() {
|
async fn post_list_cache_roundtrip() {
|
||||||
let key = CacheKey::PublishedPosts {
|
let key = CacheKey::PublishedPosts {
|
||||||
page: 999,
|
page: 999,
|
||||||
@ -370,7 +367,6 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
|
||||||
async fn tag_list_cache_roundtrip() {
|
async fn tag_list_cache_roundtrip() {
|
||||||
let tags = vec![Tag {
|
let tags = vec![Tag {
|
||||||
id: 1,
|
id: 1,
|
||||||
@ -386,7 +382,6 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
|
||||||
async fn single_post_cache_roundtrip() {
|
async fn single_post_cache_roundtrip() {
|
||||||
let post = Some(Post {
|
let post = Some(Post {
|
||||||
id: 1,
|
id: 1,
|
||||||
@ -417,7 +412,6 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
|
||||||
async fn post_stats_cache_roundtrip() {
|
async fn post_stats_cache_roundtrip() {
|
||||||
let stats = PostStats {
|
let stats = PostStats {
|
||||||
total: 10,
|
total: 10,
|
||||||
@ -433,7 +427,6 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
|
||||||
async fn cache_invalidation_works() {
|
async fn cache_invalidation_works() {
|
||||||
let post = Some(Post {
|
let post = Some(Post {
|
||||||
id: 42,
|
id: 42,
|
||||||
@ -467,7 +460,6 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
|
||||||
async fn comment_cache_roundtrip() {
|
async fn comment_cache_roundtrip() {
|
||||||
let comments = vec![PublicComment {
|
let comments = vec![PublicComment {
|
||||||
id: 1,
|
id: 1,
|
||||||
@ -489,7 +481,6 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
|
||||||
async fn comment_count_cache_roundtrip() {
|
async fn comment_count_cache_roundtrip() {
|
||||||
set_comment_count(42, 15).await;
|
set_comment_count(42, 15).await;
|
||||||
let cached = get_comment_count(42).await;
|
let cached = get_comment_count(42).await;
|
||||||
@ -499,7 +490,6 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
|
||||||
async fn pending_count_cache_roundtrip() {
|
async fn pending_count_cache_roundtrip() {
|
||||||
set_pending_count(7).await;
|
set_pending_count(7).await;
|
||||||
let cached = get_pending_count().await;
|
let cached = get_pending_count().await;
|
||||||
@ -509,7 +499,6 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
|
||||||
async fn comment_cache_invalidation() {
|
async fn comment_cache_invalidation() {
|
||||||
set_comments_by_post(99, vec![]).await;
|
set_comments_by_post(99, vec![]).await;
|
||||||
assert!(get_comments_by_post(99).await.is_some());
|
assert!(get_comments_by_post(99).await.is_some());
|
||||||
@ -519,7 +508,6 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
|
||||||
async fn comment_count_invalidation() {
|
async fn comment_count_invalidation() {
|
||||||
set_comment_count(99, 5).await;
|
set_comment_count(99, 5).await;
|
||||||
assert!(get_comment_count(99).await.is_some());
|
assert!(get_comment_count(99).await.is_some());
|
||||||
@ -529,7 +517,6 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
|
||||||
async fn pending_count_invalidation() {
|
async fn pending_count_invalidation() {
|
||||||
set_pending_count(3).await;
|
set_pending_count(3).await;
|
||||||
assert!(get_pending_count().await.is_some());
|
assert!(get_pending_count().await.is_some());
|
||||||
@ -539,7 +526,6 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[serial]
|
|
||||||
async fn invalidate_all_comment_caches_clears_everything() {
|
async fn invalidate_all_comment_caches_clears_everything() {
|
||||||
set_comments_by_post(1, vec![]).await;
|
set_comments_by_post(1, vec![]).await;
|
||||||
set_comment_count(1, 10).await;
|
set_comment_count(1, 10).await;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user