Page MenuHomePhabricator

D16225.diff
No OneTemporary

D16225.diff

diff --git a/src/infrastructure/cluster/PhabricatorDatabaseRef.php b/src/infrastructure/cluster/PhabricatorDatabaseRef.php
--- a/src/infrastructure/cluster/PhabricatorDatabaseRef.php
+++ b/src/infrastructure/cluster/PhabricatorDatabaseRef.php
@@ -12,6 +12,7 @@
const REPLICATION_MASTER_REPLICA = 'master-replica';
const REPLICATION_REPLICA_NONE = 'replica-none';
const REPLICATION_SLOW = 'replica-slow';
+ const REPLICATION_NOT_REPLICATING = 'not-replicating';
const KEY_REFS = 'cluster.db.refs';
const KEY_INDIVIDUAL = 'cluster.db.individual';
@@ -196,13 +197,18 @@
self::REPLICATION_REPLICA_NONE => array(
'icon' => 'fa-download',
'color' => 'red',
- 'label' => pht('Not Replicating'),
+ 'label' => pht('Not A Replica'),
),
self::REPLICATION_SLOW => array(
'icon' => 'fa-hourglass',
'color' => 'red',
'label' => pht('Slow Replication'),
),
+ self::REPLICATION_NOT_REPLICATING => array(
+ 'icon' => 'fa-exclamation-triangle',
+ 'color' => 'red',
+ 'label' => pht('Not Replicating'),
+ ),
);
}
@@ -330,14 +336,19 @@
}
if ($is_replica) {
- $latency = (int)idx($replica_status, 'Seconds_Behind_Master');
- $ref->setReplicaDelay($latency);
- if ($latency > 30) {
- $ref->setReplicaStatus(self::REPLICATION_SLOW);
- $ref->setReplicaMessage(
- pht(
- 'This replica is lagging far behind the master. Data is at '.
- 'risk!'));
+ $latency = idx($replica_status, 'Seconds_Behind_Master');
+ if (!strlen($latency)) {
+ $ref->setReplicaStatus(self::REPLICATION_NOT_REPLICATING);
+ } else {
+ $latency = (int)$latency;
+ $ref->setReplicaDelay($latency);
+ if ($latency > 30) {
+ $ref->setReplicaStatus(self::REPLICATION_SLOW);
+ $ref->setReplicaMessage(
+ pht(
+ 'This replica is lagging far behind the master. Data is at '.
+ 'risk!'));
+ }
}
}
}

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 23, 10:36 AM (18 h, 25 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6921130
Default Alt Text
D16225.diff (2 KB)

Event Timeline