Note @DanielX’s comment about looking into allowing writable files in the container. I think that would be super handy.
Keeping an app awake so that in-memory state persists seems like something you could never rely on at all. Not to mention it could be a big burden on HyperDev’s infrastructure. They probably save a lot by putting inactive apps to sleep.
Containers sleep after 2 minutes of inactivity* and are destroyed after 15 minutes. For the most part the filesystem within each project is stateless, so you can’t write to it. The exception is ‘/tmp’, where you can but everything gets cleared after 15 minutes. Otherwise here’s a persistence example https://hyperdev.com/#!/project/typhoon-pine as each hyperdev project gets a dynamodb.
*“Activity” is defined as active incoming connections (http or websocket). Activity does not affect the 15 minute timer, so please do not count on in-memory persistence.
One other question:
Not that I would do this (ಠ⌣ಠ), but what happens if every 90 seconds you make an http request from your application to it’s own URL? Will it just stay active forever?
Yeah, but we’d politely ask you to consider alternative ways around your issue. Every 15 minutes the container is completely removed no matter what. So whilst it would reawaken, its state would be lost anyway.
I’ve used https://www.setcronjob.com/ for a long time for this kind of thing, but I think they’ve removed their free tier. There’s a ton of other free web cron job services, but I don’t have any experience with them so can’t suggest a specific one. Zapier’s webhook and schedule zaps might also help: https://zapier.com/app/explore.
It’s a feature in our backlog too, but not a high priority for now. Feel free to let us know if it should be.
Hi Gareth, is there a recommended way to run a bot using hyperdev or am I better off self hosting and runnin? This is the use-case I’ve come across for making keep-alive requests. Referring to slack specifically so I could use an outgoing webhook but that’s limited to specific channels and not currently channels-where-the-bot-is
For Slack specifically, there’s now no real issue with using HyperDev for them following the release of their Events API. Our Slack Bot examples use that too. It gives you access to almost all functionality, no keep-alive necessary, it pushes on event like a webhook.