I have developed a bot that does a "hearbeat" towards my firebase. With this I mean: Every 10 seconds my bot updates an entry in my Firebase with the current time, letting my website know that this was the last time the bot was online.
我开发了一个机器人,对我的火力基地做了一个“听觉”。我的意思是:我的机器人每10秒用我当前的时间更新我的Firebase中的一个条目,让我的网站知道这是机器人最后一次上线。
Code
function heartbeat() {
var time = Math.floor(Date.now() / 1000);
fb.child("bot").set({
heartbeat: time
});
}
PS: Don't mind it being divided by 1000, there's other reasons for that ;)
PS:不要介意它除以1000,还有其他原因;)
The issue, however, is that after a while doing this (about a couple of hours), the bot losses (?) it's permissions? And gets the error:
然而,问题是,经过一段时间这样做(大约几个小时),机器人损失(?)它的权限?并得到错误:
"FIREBASE WARNING: set at <path> failed: permission_denied".
When I restart the bot, everything works again?
当我重新启动机器人时,一切都恢复了吗?
Is there some kind of limitations I'm missing? I'm using the "free plan" at the moment, and thought maybe this could be the reason, but I can't see why any of the limitations of my plan should effect this script?
我缺少某些限制吗?我现在正在使用“免费计划”,并认为这可能是原因,但我不明白为什么我的计划的任何限制会影响这个脚本?
Thanks!
1 个解决方案
#1
0
As Andrè commented this is most likely an issue woth the session length located in my "Login & Auth"-tab.
正如Andrè所说,这很可能是会话长度位于我的“Login&Auth”选项卡中的问题。
As he said, there's no way to extend my session length without expanding every users session (yes, there are users logging in to my site, and I don't want them to be logged in any longer).
正如他所说,没有扩展我的会话长度而没有扩展每个用户会话(是的,有用户登录到我的网站,我不希望他们再登录)。
Therefor: My simple solution to this problem is to change the bot to restart at a specific time when there are little to none users on the site :)
因此:我对此问题的简单解决方案是将网站更改为在网站上几乎没有用户的特定时间重新启动:)
#1
0
As Andrè commented this is most likely an issue woth the session length located in my "Login & Auth"-tab.
正如Andrè所说,这很可能是会话长度位于我的“Login&Auth”选项卡中的问题。
As he said, there's no way to extend my session length without expanding every users session (yes, there are users logging in to my site, and I don't want them to be logged in any longer).
正如他所说,没有扩展我的会话长度而没有扩展每个用户会话(是的,有用户登录到我的网站,我不希望他们再登录)。
Therefor: My simple solution to this problem is to change the bot to restart at a specific time when there are little to none users on the site :)
因此:我对此问题的简单解决方案是将网站更改为在网站上几乎没有用户的特定时间重新启动:)