Fixed invite logic to be lightweight
Build and Publish / Build and Publish Docker Image (push) Successful in 4m13s
Build and Publish / Build and Publish Docker Image (push) Successful in 4m13s
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "furumusic"
|
name = "furumusic"
|
||||||
version = "0.9.7"
|
version = "0.9.8"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
description = "Reusable web-app boilerplate: auth, OIDC/SSO, admin panel, user management, i18n, PostgreSQL"
|
description = "Reusable web-app boilerplate: auth, OIDC/SSO, admin panel, user management, i18n, PostgreSQL"
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ const RESPONSE_DRAIN_TIMEOUT: Duration = Duration::from_secs(2);
|
|||||||
const DEVICE_SYNC_INTERVAL: Duration = Duration::from_secs(2);
|
const DEVICE_SYNC_INTERVAL: Duration = Duration::from_secs(2);
|
||||||
const LOCAL_SEED_RECHECK_MS: i64 = 60 * 1000;
|
const LOCAL_SEED_RECHECK_MS: i64 = 60 * 1000;
|
||||||
const MAX_LINE: usize = 8 * 1024 * 1024;
|
const MAX_LINE: usize = 8 * 1024 * 1024;
|
||||||
|
/// Playback commands carry queue state but are useful only briefly and only
|
||||||
|
/// to their addressed device. They must not inflate a new peer's catch-up.
|
||||||
|
const PLAYBACK_COMMAND_TTL_MS: i64 = 5 * 60 * 1_000;
|
||||||
const MAX_OPS_PER_BATCH: i64 = 1000;
|
const MAX_OPS_PER_BATCH: i64 = 1000;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize)]
|
#[derive(Debug, Clone, Serialize)]
|
||||||
@@ -4226,11 +4229,19 @@ async fn ops_for_peer(
|
|||||||
AND a.origin_device_id = o.origin_device_id
|
AND a.origin_device_id = o.origin_device_id
|
||||||
WHERE o.user_id = $1
|
WHERE o.user_id = $1
|
||||||
AND o.seq > COALESCE(a.max_seq, 0)
|
AND o.seq > COALESCE(a.max_seq, 0)
|
||||||
|
AND (
|
||||||
|
o.kind != 'playback_command'
|
||||||
|
OR (
|
||||||
|
o.hlc_ms >= $3
|
||||||
|
AND o.payload_json->>'target_device_id' = $2
|
||||||
|
)
|
||||||
|
)
|
||||||
ORDER BY o.hlc_ms, o.op_id
|
ORDER BY o.hlc_ms, o.op_id
|
||||||
LIMIT $3",
|
LIMIT $4",
|
||||||
)
|
)
|
||||||
.bind(user_id)
|
.bind(user_id)
|
||||||
.bind(peer_device_id)
|
.bind(peer_device_id)
|
||||||
|
.bind(now_ms().saturating_sub(PLAYBACK_COMMAND_TTL_MS))
|
||||||
.bind(MAX_OPS_PER_BATCH)
|
.bind(MAX_OPS_PER_BATCH)
|
||||||
.fetch_all(pool)
|
.fetch_all(pool)
|
||||||
.await?;
|
.await?;
|
||||||
|
|||||||
Reference in New Issue
Block a user