mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
Improve pool score probing rules
This commit is contained in:
@@ -70,6 +70,7 @@ impl InMemoryPoolMemberScoreRepository {
|
||||
scores.sort_by(|left, right| {
|
||||
probe_priority(left)
|
||||
.cmp(&probe_priority(right))
|
||||
.then_with(|| right.probe_failure_count.cmp(&left.probe_failure_count))
|
||||
.then_with(|| {
|
||||
left.last_probe_success_at
|
||||
.unwrap_or(0)
|
||||
|
||||
@@ -223,6 +223,7 @@ impl PoolScoreReadRepository for MysqlPoolMemberScoreRepository {
|
||||
WHEN probe_status = 'stale' THEN 3
|
||||
ELSE 4
|
||||
END ASC,
|
||||
probe_failure_count DESC,
|
||||
COALESCE(last_probe_success_at, 0) ASC,
|
||||
COALESCE(last_scheduled_at, 0) DESC,
|
||||
member_id ASC
|
||||
|
||||
@@ -235,6 +235,7 @@ impl PoolScoreReadRepository for PostgresPoolMemberScoreRepository {
|
||||
WHEN probe_status = 'stale' THEN 3
|
||||
ELSE 4
|
||||
END ASC,
|
||||
probe_failure_count DESC,
|
||||
COALESCE(last_probe_success_at, 0) ASC,
|
||||
COALESCE(last_scheduled_at, 0) DESC,
|
||||
member_id ASC
|
||||
|
||||
@@ -223,6 +223,7 @@ impl PoolScoreReadRepository for SqlitePoolMemberScoreRepository {
|
||||
WHEN probe_status = 'stale' THEN 3
|
||||
ELSE 4
|
||||
END ASC,
|
||||
probe_failure_count DESC,
|
||||
COALESCE(last_probe_success_at, 0) ASC,
|
||||
COALESCE(last_scheduled_at, 0) DESC,
|
||||
member_id ASC
|
||||
|
||||
Reference in New Issue
Block a user