mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 17:08:27 +00:00
chore(instances): harden presence refresh and fix lint
This commit is contained in:
@@ -59,6 +59,17 @@ function ensureSelfPresence() {
|
||||
}
|
||||
}
|
||||
|
||||
function touchSelfPresence() {
|
||||
const host = os.hostname();
|
||||
const key = host.toLowerCase();
|
||||
const existing = entries.get(key);
|
||||
if (existing) {
|
||||
entries.set(key, { ...existing, ts: Date.now() });
|
||||
} else {
|
||||
initSelfPresence();
|
||||
}
|
||||
}
|
||||
|
||||
initSelfPresence();
|
||||
|
||||
function parsePresence(text: string): SystemPresence {
|
||||
@@ -96,5 +107,6 @@ export function updateSystemPresence(text: string) {
|
||||
|
||||
export function listSystemPresence(): SystemPresence[] {
|
||||
ensureSelfPresence();
|
||||
touchSelfPresence();
|
||||
return [...entries.values()].sort((a, b) => b.ts - a.ts);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user