Users: Expire old user invites (#27361)

* expire with existng cleanup service

* expire with new temp user service

* make Drone happy :)

* add expiry status

* remove other approach

* cleanup

* add test for idempotency

* add migration from datetime to unix ts

* update cmd names

* change lifetime config to duration

* remove unnecessart formatting

* add comment

* update docs

* remove max bound and introduce min error

* simplify sql

* remove comment

* allow any outstanding to exist for at least 24 hours

* revert created ts change

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>

* add extra state check to cleanup step

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
This commit is contained in:
Will Browne
2020-10-13 12:30:09 +02:00
committed by GitHub
co-authored by Marcus Efraimsson
parent 8e56dd0279
commit a189cd1832
9 changed files with 150 additions and 10 deletions
+9 -2
View File
@@ -17,6 +17,7 @@ const (
TmpUserInvitePending TempUserStatus = "InvitePending"
TmpUserCompleted TempUserStatus = "Completed"
TmpUserRevoked TempUserStatus = "Revoked"
TmpUserExpired TempUserStatus = "Expired"
)
// TempUser holds data for org invites and unconfirmed sign ups
@@ -35,8 +36,8 @@ type TempUser struct {
Code string
RemoteAddr string
Created time.Time
Updated time.Time
Created int64
Updated int64
}
// ---------------------
@@ -60,6 +61,12 @@ type UpdateTempUserStatusCommand struct {
Status TempUserStatus
}
type ExpireTempUsersCommand struct {
OlderThan time.Time
NumExpired int64
}
type UpdateTempUserWithEmailSentCommand struct {
Code string
}