Skip to content
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

Merged
merged 11 commits into from
Feb 21, 2025

Conversation

augustoccesar
Copy link
Collaborator

Closes DO-1929

@augustoccesar augustoccesar self-assigned this Feb 20, 2025
@augustoccesar augustoccesar marked this pull request as ready for review February 20, 2025 16:05
#[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" {
Copy link
Contributor

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?

Copy link
Collaborator Author

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 {
Copy link
Contributor

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?

Copy link
Collaborator Author

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 🤔

Copy link
Contributor

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?

Copy link
Collaborator Author

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

@augustoccesar augustoccesar merged commit 0c4e8f0 into 2.0 Feb 21, 2025
4 checks passed
@augustoccesar augustoccesar deleted the augustoccesar/schedule-sessions-cleanup branch February 21, 2025 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants