|
|
@@ -61,12 +61,21 @@ export default function WorkerStatusPage() {
|
|
|
|
|
|
const getHealthStatus = (worker: WorkerStatus) => {
|
|
|
const now = new Date().getTime();
|
|
|
- const lastUpdate = new Date(worker.updated_at).getTime();
|
|
|
+ let updateTimeStr = worker.updated_at;
|
|
|
+ if (updateTimeStr && !updateTimeStr.endsWith('Z') && !updateTimeStr.includes('+')) {
|
|
|
+ updateTimeStr += 'Z';
|
|
|
+ }
|
|
|
+ const lastUpdate = new Date(updateTimeStr).getTime();
|
|
|
const diffMinutes = (now - lastUpdate) / 1000 / 60;
|
|
|
-
|
|
|
- if (worker.last_error) return { label: '报错', color: 'bg-red-50 text-red-700 border-red-200', icon: AlertTriangle };
|
|
|
- if (diffMinutes > 10) return { label: '离线/卡死', color: 'bg-gray-100 text-gray-500 border-gray-200', icon: Clock };
|
|
|
- if (diffMinutes > 5) return { label: '延迟', color: 'bg-yellow-50 text-yellow-700 border-yellow-200', icon: Clock };
|
|
|
+ if (worker.last_error) {
|
|
|
+ return { label: '报错', color: 'bg-red-50 text-red-700 border-red-200', icon: AlertTriangle };
|
|
|
+ }
|
|
|
+ if (diffMinutes > 10) {
|
|
|
+ return { label: '离线/卡死', color: 'bg-gray-100 text-gray-500 border-gray-200', icon: Clock };
|
|
|
+ }
|
|
|
+ if (diffMinutes > 5) {
|
|
|
+ return { label: '延迟', color: 'bg-yellow-50 text-yellow-700 border-yellow-200', icon: Clock };
|
|
|
+ }
|
|
|
return { label: '运行中', color: 'bg-green-50 text-green-700 border-green-200', icon: Activity };
|
|
|
};
|
|
|
|