Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Add a new feature auto unlock #164

Merged
merged 6 commits into from
Oct 17, 2021
Merged

Add a new feature auto unlock #164

merged 6 commits into from
Oct 17, 2021

Conversation

noahingh
Copy link
Member

@noahingh noahingh commented Oct 11, 2021

The worker deletes expired locks periodically in the background.

In UI, users could set up the auto-unlock by the date picker like the following. users do not take care of unlocking after occupying the envrionment.

image

@noahingh noahingh added component: server This issue or pull request is related to the feature of the server-side component: ui This issue or pull request is related to the feature of the UI-side labels Oct 11, 2021
@noahingh noahingh linked an issue Oct 11, 2021 that may be closed by this pull request
@noahingh noahingh added the schema-migration This pull request has a schema-migration label Oct 16, 2021
Comment on lines +23 to +32
ls, err := i.ListExpiredLocksLessThanTime(ctx, t)
if err != nil {
i.log.Error("It has failed to read expired locks.", zap.Error(err))
continue
}

for _, l := range ls {
i.DeleteLock(ctx, l)
i.log.Debug("Delete the expired lock.", zap.Int("id", l.ID))
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete locks that are less than the time.

@noahingh noahingh changed the title Add the expired_at field for Lock to unlock automatically Add a new feature auto unlock Oct 17, 2021
@noahingh noahingh marked this pull request as ready for review October 17, 2021 09:58
@noahingh noahingh merged commit 97c2f86 into main Oct 17, 2021
@noahingh noahingh deleted the auto-expired-lock branch October 17, 2021 10:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
component: server This issue or pull request is related to the feature of the server-side component: ui This issue or pull request is related to the feature of the UI-side schema-migration This pull request has a schema-migration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide the feature auto unlock
1 participant