我想将下面的javascript代码片段转换为python,以便于使用flask进行开发
async function run() {
// TODO: If isIngame is false then getTeamData, saveJson and exit the program otherwise getPlayerData
if (isIngame === false) {
clearInterval(isIngame__id);
await getTeamData();
await saveJson();
clearInterval(run__id);
console.log("DONE");
process.exit();
} else {
await getPlayerData();
console.log("Running");
}
}
isIngame__id = setInterval(() => {
inGameStatus();
}, apiRequestPeriod);
run__id = setInterval(async() => {
await run();
}, apiRequestPeriod);
是否有一个高效的setInterval()等价于javascript,我可以每隔1秒在两个不同的端点以非阻塞方式ping我的API?停止这两个事件的自定义事件inIngame
变为False
目前没有回答
相关问题 更多 >
编程相关推荐