-
Notifications
You must be signed in to change notification settings - Fork 887
feat: add "dormant" user state #8644
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
Conversation
require.Eventually(t, func() bool { | ||
rows, err = db.GetUsers(ctx, database.GetUsersParams{}) | ||
if err != nil { | ||
return false | ||
} | ||
|
||
var c int | ||
for _, row := range rows { | ||
if row.Status == database.UserStatusDormant { | ||
c++ | ||
} | ||
} | ||
// 6 users in total, 3 dormant | ||
return len(rows) == 6 && c == 3 | ||
}, testutil.WaitShort, testutil.IntervalMedium) | ||
|
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.
Suggestion: if you allow passing in a tick chan time.Time
and updated chan int
into CheckInactiveUsersWithOptions
you can then conceivably remove this require.Eventually
- you write a time to tick
, and read the number of updated users from updated
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.
This is a good hint in case we want to do something more with these accounts than validate in unit tests. I would keep it simple as is.
SET | ||
user_status = 'dormant'::user_status | ||
WHERE | ||
last_seen_at < @last_seen_after :: timestamp |
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.
note for readers: this is correct as last_seen_at
is timestamp without time zone
.
Related: #8128
This PR officially introduces another user account status -
dormant
. Users who have not logged in yet to the Coder platform will be marked as dormant, and will not be included in the license seat calculations.Low-level changes:
dormant
user statusExtractAPIKeyMW
to switch a "dormant" account to "active"Testing:
@coder.com
Google accountNotes:
Next steps: