fix: 🐛 unlock undefined
This commit is contained in:
parent
4ed0b60621
commit
805230341e
@ -15,8 +15,6 @@ export async function fetchInstanceMetadata(
|
||||
instance: Instance,
|
||||
force = false,
|
||||
): Promise<void> {
|
||||
const unlock = await getFetchInstanceMetadataLock(instance.host);
|
||||
|
||||
if (!force) {
|
||||
const _instance = await Instances.findOneBy({ host: instance.host });
|
||||
const now = Date.now();
|
||||
@ -24,7 +22,7 @@ export async function fetchInstanceMetadata(
|
||||
_instance?.infoUpdatedAt &&
|
||||
now - _instance.infoUpdatedAt.getTime() < 1000 * 60 * 60 * 24
|
||||
) {
|
||||
unlock();
|
||||
await getFetchInstanceMetadataLock(instance.host);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -53,7 +51,7 @@ export async function fetchInstanceMetadata(
|
||||
} as Record<string, any>;
|
||||
|
||||
if (info) {
|
||||
updates.softwareName = info.software?.name.toLowerCase();
|
||||
updates.softwareName = info.software?.name?.toLowerCase() || null;
|
||||
updates.softwareVersion = info.software?.version;
|
||||
updates.openRegistrations = info.openRegistrations;
|
||||
updates.maintainerName = info.metadata
|
||||
@ -80,24 +78,24 @@ export async function fetchInstanceMetadata(
|
||||
} catch (e) {
|
||||
logger.error(`Failed to update metadata of ${instance.host}: ${e}`);
|
||||
} finally {
|
||||
unlock();
|
||||
await getFetchInstanceMetadataLock(instance.host)
|
||||
}
|
||||
}
|
||||
|
||||
type NodeInfo = {
|
||||
openRegistrations?: any;
|
||||
openRegistrations?: boolean;
|
||||
software?: {
|
||||
name?: any;
|
||||
version?: any;
|
||||
name?: string;
|
||||
version?: string;
|
||||
};
|
||||
metadata?: {
|
||||
name?: any;
|
||||
nodeName?: any;
|
||||
nodeDescription?: any;
|
||||
description?: any;
|
||||
name?: string;
|
||||
nodeName?: string;
|
||||
nodeDescription?: string;
|
||||
description?: string;
|
||||
maintainer?: {
|
||||
name?: any;
|
||||
email?: any;
|
||||
name?: string;
|
||||
email?: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user