-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: scheduled clean up of unused tunnels #172
Conversation
worker/src/lib.rs
Outdated
#[event(scheduled)] | ||
async fn scheduled(event: worker::ScheduledEvent, env: Env, _ctx: worker::ScheduleContext) { | ||
// Is the every weekday at midday schedule | ||
if event.cron() == "0 12 * * 2-6" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this check needed? Just run whenever scheduled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't really need it hahah since we just have one schedule, is fine to just do it.
Changed on 3554a1f
|
||
let now = worker::Date::now(); | ||
|
||
for key in tunnels_keys { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you need to add to remove the key in here after delete too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if I get what you mean 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in remove the key/value tunnel pair from the kv store after deleting the dns record and tunnel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha! Yes! Added on bbfb665
Closes DO-1929