judge: sysinfo: only get stack size when needed

This commit is contained in:
undefined committed 2022-04-05 21:45:40 +08:00
1 parent 37e72fa5ae
commit b17bc16d66
1 file changed
+3 -1
+3 -1
View File
@@ -27,6 +27,7 @@ int main(){
}`,
},
config: {
type: 'default',
time: '3s',
memory: '256m',
},
@@ -64,10 +65,11 @@ int main(){
return parseInt(a[a.length - 2], 10);
}
const stackPromise = stackSize();
let stackPromise;
export async function get() {
const info = await _get();
if (!stackPromise) stackPromise = stackSize();
// @ts-ignore
info.stack = await stackPromise;
return info;